From www.move2008.com
Download PDF documentation
The RDA (Remote Data Access) object provided using SQLCE can easily implement the PocketPC SQLCE database synchronization with the PC SQL Server2000 database, and the synchronization between them is transmitted through http, so there must be a background web server. There are also a variety of synchronous transmission media, such as infrared, bottom, wireless network card, etc. The synchronization process is shown below:
First, the installation and setting of the PC server
Install SSCESERVER 1.0
1. Install (download)
Http://www.microsoft.com/sql/ce/downloads/default.asp
Install and configure IIS5.0 (or higher)
Installation
Click Start, Control Panel, and then click Add / Remove Programs. Click Add / Remove Windows Components. Windows Component Wizard appears. Follow the instructions on the screen to install, delete or add an Internet Information Services (IIS) component. After installation, type http: // localhost / then press Enter in the address bar of the IE, if there is normal display, IIS is installed correctly, if you encounter problems, you can view the IIS online documentation.
2. Configuration
Open Control Panel -> Administrative Tools -> Internet Information Services, the setting steps are shown in the following graph:
(1) Increase the virtual directory
(2) Virtual directory name: SQLCE
(3) Fill in the virtual directory path
(4) Set access (Note: Select "Perform (such as ISAPI Application or CGI)")
(5) Is the test installation correct
Open the IE browser and enter http://localhost/sqlce/sscesa10.dll in the address bar.
If the display is "Body", the setting is correct.
Second, the installation of the PocketPC
Install SQLCE1.0
Download from Microsoft Website:
Http://download.microsoft.com/download/sqlsvr2000/UTILITY/3.0/NT5XP/EN-US/Sqldash.exe
After decompression: c: /sqldash/sqldash/ppc/ppcsetup.exe
Or from www.move2008.com download: www.move2008.com/down/download/ssce.arm720c.cab
After downloading, COPY can be opened to PocketPC.
Create a SQLCE database on PocketPC
The creation table code is as follows:
Public goadoxcat as adoxce.catalog
Set adoxcat = creteObject ("adoxce.catalog.3.1)
Adoxcat.create "provider = microsoft.sqlser.Oledb.ce.1.0; data source = / test"
Third, database synchronization code (EVB / ASP)
'Database connection ADO Connection object
Public conn as adoe.connection
Public LocalConnstr, RemoteConnstr, InternetURL, Serverip As String
'Pre-primaryization before synchronization
Public function syncinit ()
'Local SQLCE Connection ConnectString
LocalConnstr = "provider = microsoft.sqlser.Oledb.ce.1.0; data source = / test"
SET CONN = CreateObject ("Adoe.Connection.3.0")
Conn.Connectionstring = localconnstr 'If the database is open,
IF conn.state = 1 THEN CONN.CLOSE
'PC server address
Serverip = "192.168.0.1"
'Remote SQL Server2000 Database Connection Address
RemoteConnstr = "provider = SQLOLEDB; Initial Catalog = AircraftMobile; data source =" serverip "; user ID = test; password = test;"
'The SQLCE synchronized web address on the remote PC (in IIS setting)
InternetURL = "http: //" Serverip "/sqlce/sscesa10.dll"
END FUNCTION
'data synchronization
Public Function SyncTable (TableName, SQL)
Deltable (TableName)
Set Cerda = CreateObject ("SSCE.RemoteDataAccess.1.0")
CERDA.LOCALCONNECTIONSTRING = LocalConnstr
Cerda.InterNeturl = InternetURL
ON Error ResMe next
'Synchronize the table in the PC database to PocketPC
Cerda.pull Tablename, SQL, RemoteConnstr, Trackingoff
'Synchronize data in pocketpc to the PC
'This trip has been commented: gorda.push tablename, RemoteConnStr
IF CERDA.ErrorRecords.count> 0 THEN
For Each Gceerr in Cerda.ErrorRecords
STRERR = ""
STRERR = STRERR "Error Number:" Trim (Gceerr.nativeError) ""
STRERR = STRERR "Target:" Gceerr.Description ""
Msgbox Tablename ":" STRERR
NEXT
END IF
Set Cerda = Nothing
END FUNCTION
'Delete Table
Public Function DelTable (TableName)
SET CONN = CreateObject ("Adoe.Connection.3.0")
Conn.connectionstring = "provider = microsoft.sqlser.oledb.ce.1.0; data source = / test"
Conn.open
ON Error ResMe next
Conn.execute ("DROP TABLE" TABLENAME)
Conn.close
END FUNCTION
'Remote operation PC server database
Function Remotesql (SQL)
IF TRIM (SQL) <> "" ""
IF MID (SQL, LEN (SQL), 1) <> ";" Then SQL = SQL & ";" SET CERDA = CREATEOBJECT ("ssce.remoteDataAccess.1.0")
Cerda.InterNeturl = InternetURL
SQL = "Begin Transaction; Use test;" & SQL & "CommST
ON Error ResMe next
CERDA.SUBMITSQL SQL, RemoteConnStr
IF CERDA.ErrorRecords.count> 0 THEN
For Each Gceerr in Cerda.ErrorRecords
STRERR = ""
STRERR = STRERR & "Error Number:" & Trim (Gceerr.nativeError) & vbcrlf
STRERR = STRERR & "Error Target:" & gceerr.description & vbcrlf
MSGBOX Strerr
NEXT
END IF
Set Cerda = Nothing
END IF
END FUNCTION
Bedlang
2002-11-1