Skip to main content

Articles

News

Windows Mobile Developer Controls
Windows Mobile Developer Controls

Using the SQL Server CE RDA Pull method.

Written by Derek Mitchell  [author's bio]  [read 39462 times]
Edited by Derek

Download the code

Page 1  Page 2  Page 3 

File spec for the local SS CE

gFullFileSpec = gDBFileSpec & gDBName

gDBFileSpec: the path for the local SS CE database
gDBName: the file name for the SS CE database

The ole db provider for SS CE is declared in the declarations section:
Const gSQLEProvider = "Provider=Microsoft.SQLSERVER.OLEDB.CE.1.0; data source="

Connection information for the remote SS

Const gRemoteSQLServerName = "RemoteSQLServerName"
Const gRemoteProvider = "Provider=sqloledb;Initial Catalog=Northwind;"
Const gInternetURL = "HTTP://192.168.0.15/Northwind/SSCESA10.DLL"
Const gInternetLogin = ""
Const gInternetPwd = ""
Const gRemoteSQLServerUID = "your_sql_username"
Const gRemoteSQLServerPwd = "your_sql_password"
Public gRemoteConnect As String

gRemoteSQLServerName: The name of the remote SQL server you want to connect to. Open up the desktop SQL Enterprise Manager and look for the name in the SQL Server Group - normally this is the computer name of the desktop.
gRemoteProvider: The ole dB provider string plus the name of the database you will be pulling information from, in this instance 'Northwind'.
gInternetURL: The internet URL of the ISAPI CE server agent DLL (SSCESA10.DLL)
gInternetLogin: The HTTP authentication information if not using anonymous access
gInternetPwd: The HTTP authentication information if not using anonymous access
gRemoteSQLServerUID: Remote SS user name
gRemoteSQLServerPwd: Remote SS password

In the Form Load() event we concatenate some of the above information into the RemoteConnect string:

gRemoteConnect = gRemoteProvider & _
"Data Source=" & gRemoteSQLServerName & _
";UID=" & gRemoteSQLServerUID & _
";password=" & gRemoteSQLServerPwd

Initialing the database

Next we initialize the database with the InitDB routine. We check to see whether the database (gFullFileSpec) exists, and whether to overwrite it or not. To overwrite it we delete it using the FileSystem.Kill method then create it by calling the Create method of the ADOXCE.Catalog and passing it the ole dB provider information plus the full file spec of the local database [gSQLEProvider + gFullFileSpec] in the CreateDB routine.

Previous Page  Next Page