RDA enables data access between SQL ce and SQL Server

Source: Internet
Author: User
Tags remote desktop access

RDAImplementationSQL CEAndSQL ServerInter-Data Access

PPC ProgramAnd Desktop PC Currently, there are two programming methods for communication, 1 , Utilization Socket Programming and desktop program communication; 2 , Utilization RDA And Replication (Replication) programming the database to complete with the Desktop SQL Server Database Access. Exploitation Socket Programming is actually through TCP/IP Protocols and desktops PC For communication, it can easily transmit general types of data, such as strings, integers, and bytes. However, if you need to transmit typed data, You Need To encapsulate it by the programmer, in addition, if you want a smart device to return data from a specified database table from the desktop database engine, you must write a desktop interface service program to query data and pass the results Socket Return to the smart device. Then how can we Pocket PC On the Desktop PC Access the local database or even Remote Desktop PC What about the database? By using smart devices Pocket PC Running on SQL Server CE We can easily access and place Pocket PC On SQL Server CE Database, you can also use SQL Server CE In RDA Or merge replication to quickly enable remote desktop access from smart devices. SQL Server2000 Database

 

What isRDA

Remote Data access, that isRemote Data Access(AbbreviatedRDA), This technology is available inWindows ce2.11The version already exists.Web SQL Server 2000 for CEWhen it appears, its functions are more enriched by using this technology. And in various network environments, you canPocket PCConnect to remoteSQL Server 2000Database. If this is the first connection, the mobile deviceSQL Server 2000Download the data to be queried. If it is not the first query, the mobile device will compare the content in the local database and remote database. And update the information in the remote database.

RDATechnology data transmission.

PassRDATechnology, which can complete the following types of data transmission:

 Download data from the server. When the local database on the mobile device has no content, you can useRDARemote technical supportSQL Server 2000The server downloads the initialization data to the local device.SQL Server CEDatabase. For example, the application usesRDAThe technical download terminal supports the login data and original product data to the local mobile database to complete system initialization. Without this initial initialization step, the system will not be able to log on.

 Upload data to the server. Applications on mobile devices allow operators to log on to and use the system after initialization. Operator input and collection information (suchGPSInformation and bar code information) will be stored in the mobile database, at this time, you can useRDATechnology uploads local dataSQL Server 2000Server. It is worth noting that when designing a server-side database, there cannot be self-increment fields in the table to be synchronized; otherwise, data upload may fail, the cause is that different mobile devices perform auto-incrementing operations on the same field in the table.

 Update Server data. Sometimes, the same record may exist in databases on multiple mobile devices and databases on the server. In this case, the server record is subject to the record in the last synchronization of mobile devices.

 Release without returnT-SQLCommands to operate remote servers (Submit SQL). Apps on mobile devices can useT-SQLCommand Remote OperationSQL Server 2000Database. This function is very practical. We usually need to record the current time when collecting data. However, if there are multiple mobile devices, the machine time of each mobile device may be inconsistent, the solution to this situation is to useSubmit SQLRefresh the server time, download the time, and set it to the time of the mobile device at the same time.

SQL Server CEArchitecture Diagram  .

 

Pull(Pull data)

 Pulling data isWindows CESlaveSQL ServerThe process of obtaining data from the server can also be understood as downloading data from the server. The user does not have to care about the processing process between them, but only needs to callIsscerdaInterfacePullMethod.PullThe method is defined as follows:

Virtual/* [ID] */hresult stsmethodcalltypy pull (

/* [In] */BSTR localtablename,

/* [In] */BSTR sqlselectstring,

/* [In] */BSTR oledbconnectionstring,

/* [Defaultvalue] [in] */rda_trackoption trackoption

/* [Defaultvalue] [in] */BSTR errortablename) = 0;

 

 

Parameters

Description

Localtablename

Store the data obtained from the server to this table. If the table already exists, an error occurs.

Sqlselectstring

IndicatesSQLExpression, which controls what data is obtained from the server. The stored procedures and views of returned result sets are also supported. If you want to transmit data from multiple tables on the serverCEIn a tableTrackoptionSet the parameter valueTRAC King OffThe obtained data cannot be uploaded to the server.

Oledbconnectionstring

ConnectSQL ServerServer connection string

Rda_trackoption

IndicatesSQL Serve CEWhether to trace the table that stores and obtains server data (Localtablename. The value is an enumerated value As shown in.

Errortablename

IndicatesCEName of the local error table. Call laterPushMethod When submitting changed data to the server. If an error occurs, the error table is created and written with the error message. If you callPullThe error table already exists.

 

TableParametersTrackoptionValue

Constant

Value

Description

TRAC King On

1

For tables that receive data,SQL Serve CEAll changes will be tracked, and the primary key constraint will be based onSqlselectstringExecuted and created. This value is the default value.

TRAC King Off

0

For tables that receive data,SQL Serve CEAll changes will not be tracked, and the primary key constraint will not be created in the local table.

TRAC King On_indexes

2

For tables that receive data,SQL Serve CEAll changes will be tracked. If the index and primary key are already inSQL ServerThe table exists and the field is specified inSqlselectstringIn the query statement, the index and primary key in the server table will be createdCELocal table.

TRAC King Off_indexes

3

For tables that receive data,SQL Serve CEAll changes will not be tracked. If the index and primary key are already inSQL ServerThe table exists and the field is specified inSqlselectstringIn the query statement, the index and primary key in the server table will be createdCELocal table.

 

Push(Push data)

 

Pushing data and pulling data are two completely different methods. When pushing dataCEThe data in the local database is uploaded to the server.PushThe method is defined as follows:

Virtual/* [ID] */hresult stsmethodcalltypy push (

/* [In] */BSTR localtablename,

/* [In] */BSTR oledbconnectionstring,

/* [Defaultvalue] [in] */rda_batchoption batchoption)= 0;

 

 

Parameters

Description

Localtablename

Table Name of the changed data to be uploaded to the server

Oledbconnectionstring

To connectSQL ServerServer connection string

Rda_batchoption

Indicates how to upload data. The value is an enumerated value The two values shown in.

 

TableParametersBatchoptionValue

Constant

Value

Description

Batchingoff

 

The uploaded data is updated to the server one by one.

Batchingon

 

The uploaded data is updated to the server at a time.

 

Submit(RemoteT-SQLOperation)

SubmitMethod can be executed remotelySQLStatement, that isSQLThe statement is passed to the server for direct execution. Its definition is as follows:

Virtual/* [ID] */hresult stsmethodcalltypy submit (

/* [In] */BSTR sqlstring,,

/* [In] */BSTR oledbconnectionstring,)= 0;

 

 

Attribute

Description

Sqlstring

IndicatesSQLStatement

Oledbconnectionstring

To connectSQL ServerServer connection string

Trackback: http://tb.blog.csdn.net/TrackBack.aspx? Postid = 1 6220 83

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.