Page 1
Page 2
Page 3
They say the
road to hell is paved with good intentions. If so I must have traveled some distance
down that path since I have been meaning to add this tutorial for some time! But
better late than never. This quick tutorial will show you how to use RDA to pull
a table from a SQL Server database, how to connect to the local copy of SQL Server
and retrieve the Customer list.
Goal of this tutorial
-
Connect to a remote SQL Server
-
Pull the Northwind Customers table into SS CE on your Pocket PC
-
Display the records from the local SS CE table
What
you need to complete this tutorial
- SQL Server 6.5,
7.0 or 2000
- SQL Server CE (which requires a copy of
SQL Server 2000 Developers Edition)
- eVB
Before
you start this tutorial it would be a good idea to read the article
on configuring SS CE. A quick check to see whether this is correctly configured
from a permissions perspective is to open a browser and enter the URL to the SSCESA10.DLL;
for example for my desktop it is:
HTTP://192.168.0.15/Northwind/SSCESA10.DLL
hit
enter and you should see the word 'Body' appear in the browser window.
At this stage you can pretty safely assume:
- you
have the SSCESA10.DLL correctly registered
- the IIS
virtual directory and access permissions are correctly set up for anonymous authentication
SQL
Server CE Books Online
There seems to be a fair amount
of confusion with respect to the functionality and setup of SQL Server CE. If
you have struggled with MS documentation in the past be prepared for a pleasant
surprise. The SS CE Books Online is very good. Most of the answers are in there
and it is laid out pretty well - so RTFM - read the manual.
Getting
Started
I have made this project as simple as possible
and as such all the code is declared in the form; it is always good practice to
separate out the presentation and application layers wherever possible. In addition
there is no error handling, although I will briefly touch on the SSCEErrors
collection. Remember to add the CE SQL Server control, ADO control 3.1 and
CE ADO ext 3.1 for DDL to the project references.
The
Variables
The first thing we do on initialization of
the app is set the variables for connecting to the remote SQL Server (SS)
and the local instance of SQL Server for CE (SS CE). It is good practice
to do this since you will inevitably develop against several different SS CE databases
and remote SQL Servers and using discrete variables will allow your code a higher
degree of reusability. You will notice in the form load event we have the following
code:
'init the filespec
'of the local database
gFullFileSpec = gDBFileSpec & gDBName
'init connecting information.
gRemoteConnect = gRemoteProvider & _
"Data Source=" & gRemoteSQLServerName
& _
";UID=" & gRemoteSQLServerUID & _
";password="
& gRemoteSQLServerPwd
You need to remember that there
are two sets of variables here; one governing the connection information for the
remote SS and the other specifying the file spec for the local SS CE.
Next Page