This article describes how to use RDA (remotedataaccess Remote data access) to achieve data access between SQL Server CE 2.0 and desktop SQL Server 2000 databases on the handheld Pocket PC (PPC). We will use Visual Basic. Net 2003 for Intelligent device-side program development.
I. Overview
PPC Program and desktop PC communication between the two types of programming, 1, the use of socket programming and desktop programs to communicate; 2, use RDA and Replication (replication) for database programming to complete the access to the desktop SQL Server database. The use of socket programming is actually through the TCP/IP protocol to communicate with the desktop PC, it can easily transfer the general type of data, such as: String, Integer and byte, but if you need to transfer typed data will need to encapsulate the programmer themselves, And if you want a smart device to return data from the desktop database engine to a specified database table, you must write a desktop interface service to query the data and return the results to the smart device via a socket. So how do you access a local database, or even a remote Desktop PC database, on a Pocket PC like on a desktop PC? With SQL Server CE running on the smart device Pocket PC, we can easily access the SQL Server CE database that is placed on the Pocket PC, and you can also use SQL Server RDA in CE or merge replication quickly implements a database that accesses Remote Desktop SQL Server2000 from a smart device.
Second, technical points
SQL Server CE full name is Microsoft SQL Server Windows CE Edition, which provides a solution to access lightweight databases for mobile smart devices and embedded devices. By using development tools such as Microsoft Visual Studio. NET or Microsoft eMbedded Visual Tools, we can extend the enterprise data management capabilities of SQL Server over the Windows CE-based smart platform. SQL Server CE can be applied to three of typical environments:
1. Development environment, which is used to develop desktop PCs based on the SQL Server CE program, that desktop PC must include Microsoft Visual Studio. NET or Microsoft EMbedded Visual Tools 3.0 and Pocket PC SDK development tools;
2, the client environment, is used to run the SQL Server CE program based Pocket PC device, when the device does not have available network connectivity, you can use the Microsoft ActiveSync to the Server environment desktop PC cabling;
3, server environment, is the computer running Microsoft Internet Information Service (IIS) and Microsoft SQL Server instance, you can deploy IIS and SQL Server on the same machine. Can also be configured to more than one calculation. Both RDA and merge replication require the use of IIS to communicate with SQL Server.
SQL Server CE relies on several components to exchange data with SQL Server:
1. The database engine is used to manage data storage on Windows CE devices and to track additions, updates, and deletions of database records;
2. The SQL Server CE Client Agent is a component for connections running on a Windows CE device, including replication objects, RDA objects, and the database engine, which enable you to control the connection to SQL Server;
3. The SQL Server CE Server Agent handles HTTP requests from the SQL Server CE Client agent. When the SQL Server CE Client Agent sends a request to the SQL Server CE Server Agent through the HTTP protocol, the SQL Server CE Server Agent connects to SQL Server and passes the queried recordset through the HT The TP protocol is then passed back to the SQL Server CE Client Agent, and all data transfers are dependent on IIS for completion.
By the above communication process we know that SQL Server CE remote connection and access requires the use of the Web Transport protocol HTTP or Https,sql server CE Client Agent must be running on Windows CE devices, SQL Server CE Serve The R agent runs on the desktop PC, and the computer must also have IIS installed to use RDA or merge replication to communicate with SQL Server. The network connections supported by SQL Server CE are Ethernet, wireless LAN, and Wireless WAN. You can use a Microsoft Activesync,pocket PC device to connect directly to SQL Server on your desktop PC using a serial port, infrared or USB, or you can test the connection between SQL Server CE and desktop SQL Server.
Remote Data Access (RDA) object is Microsoft SQL Server Windows CE (SQL Server CE) for programmable access remote Microsoft SQL Server 2000 or Micros OFT SQL Server version 7.0 database ActiveX controls, we can use RDA to access remote databases as simple as operating a local database on a desktop PC.