Microsoft KB Archive/302349

= HOWTO: Perform RDA Pull by Using SSCERelay and ActiveSync =

Article ID: 302349

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft SQL Server 2000 Windows CE Edition

-



This article was previously published under Q302349



SUMMARY
This article describes how to perform Remote Data Access (RDA) pull by using SSCERelay and ActiveSync.



MORE INFORMATION
The following steps describe how to use SSCERelay and ActiveSync to pull data from the Customers table in the Northwind sample database to a Windows CE device by using RDA.  Run SQL Server CE relay manually: Open a command prompt on Windows 2000, change the directory to \Program Files\Microsoft SQL Server CE\Relay, and then run the following command to start SSCERelay manually:

sscerelay /clientport 81 /servername  /serverport 80

where  is the name of your Internet Information Services (IIS) server.

NOTE: Optionally, you can specify the /register option at the end of the command line.

  Create a new Microsoft eMbedded Visual Basic application: Add a command button to the default form and paste the following code in for the command: Private Sub Command_Click

' Using USB connection with Relay Const strConnect = &quot;Provider=microsoft.sqlserver.oledb.ce.1.0;Data Source=\Local.sdf&quot;

' Declare the SQL Server CE ActiveX Control RDA Object Control.

Dim ceRDA As ssce.RemoteDataAccess

' Create the RDA Object

Set ceRDA = CreateObject(&quot;SSCE.RemoteDataAccess.1.0&quot;)

' Set Internet properties

ceRDA.InternetURL = &quot;http://myIISServerName/ssce/sscesa10.dll&quot; ceRDA.InternetProxyServer = &quot;ppp_peer:81&quot;

'  ceRDA.InternetLogin = &quot;MyInternetLogin&quot; '  ceRDA.InternetPassword = &quot;MyInternetPassword&quot;

ceRDA.LocalConnectionString = strConnect On Error Resume Next ceRDA.Pull &quot;LocalCustomers&quot;, &quot;SELECT * FROM Customers&quot;, &quot;provider=sqloledb;data source=MySQLServer;Initial Catalog=Northwind;user id=myUser;password=myPassword&quot;, 0 ShowErrors (ceRDA.ErrorRecords) Set ceRDA = Nothing End Sub

Sub ShowErrors(ErrColl As SSCEErrors)

'Initialize error variables to view error collection Dim ErrRec As Object 'SSCE.ErrorRecords Dim param As Object Dim strErr As String strErr = &quot;&quot;

For Each ErrRec In ErrColl strErr = strErr & &quot;Source: &quot; & ErrRec.Source & vbCrLf strErr = strErr & &quot;Number: &quot; & Hex(ErrRec.Number) & vbCrLf strErr = strErr & &quot;NativeError: &quot; & ErrRec.NativeError & vbCrLf strErr = strErr & &quot;Description: &quot; & ErrRec.Description & vbCrLf For Each param In ErrRec.Params strErr = strErr & &quot;Param&quot; & &quot; = &quot; & param.param & vbCrLf Next param strErr = strErr & vbCrLf Next ErrRec MsgBox strErr, vbOKOnly

End Sub

NOTES:

 The InternetProxyServer property must be set to ppp_peer:81 (all lower case). If you try &quot;PPP_Peer:81&quot; (uppercase) the application may not work. Replace &quot;Local.sdf&quot; with the name of the database on the device. Replace &quot;myIISServerName&quot; with the correct IIS computer name and specify the appropriate IIS authentication parameters. The URL that is used in this code assumes that the IIS virtual directory name is &quot;ssce&quot;. Replace &quot;ssce&quot; with the modified name if needed.</li> Edit the pull method properties to reflect the correct SQL Server name, user ID, and password.</li></ul> </li> Add references: From the Project menu, click References and add references to the following:

<ul> Microsoft CE ADO Control 3.1</li> Microsoft CE ADO ext. 3.1 for DDL</li> Microsoft CE SQL Server Control 1.0</li></ul> </li></ol>

<div class="references_section">