SQL Server 2000 and SQL Server ce2.0 use sqlceremotedataaccess to synchronize data
I have installed SQL Server 2000 and SQL Server ce2.0, and then I will install patches for these two, the patches I installed are: microsoft_sql2ksp4chs1.exeand sqlce20sql2ksp4.exe (that is, SQL Server ce server tools). Make sure the two patches are of the same version. Both of them are of SP4.
(1) install microsoft_sql2ksp4chs1
you must first install this microsoft_sql2ksp4chs1. It is easy to install SQL Server2000, just follow the steps below.
(2exe install sqlce20sql2ksp4.exe
Note: before installation, ensure that the IIS service has been started.
I. follow the prompts to install
II. go to the SQL Server ce virtual directory creation wizard interface
III. enter the virtual directory name "sscepubs" (you can name it yourself)
IV. select "Anonymous Access"
v. next, no selection
VI. after installation is complete
(3) Modify SQL Server 2000
go to the SQL Server Enterprise Manager, select security in the running sever, and create a new login, new User iuser_computer name (Internet Guest account) is added and stored in the database
select the database to be accessed in the access process, add the "db_owner" role, and click "OK".
(4) test whether the installation is successful
in IE, enter the http: // server IP Address/sscepubs/sscesaw.dll. If the connection is successful and "SQL Server ce agent" appears
This is fine, you can use sqlceremotedataaccess to synchronize data.
pull extracts data from the SQL Server database and stores it in the table of the SQL Server ce database.
// connection string to SQL Server.
string rdaoledbconnectstring = "provider = sqloledb; Data Source = mysqlserver; initial catalog = northwind;" +
"User ID = username; Password = ";
// initialize RDA object.
sqlceremotedataaccess RDA = NULL;
Try {
// Try the pull operation.
RDA = new sqlceremotedataaccess ();
RDA. internetlogin = "mylogin ";
RDA. internetpassword = "<password> ";
RDA. interneturl = "http: // server IP Address/sscepubs/sscesaw.dll ";
RDA. localconnectionstring = @ "provider = Microsoft. sqlserver. oledb. ce.2.0; Data Source = \ SSCE. SDF ";
RDA. Pull (
"Employees ",
"Select * from employees ",
Rdaoledbconnectstring,
Rdatrackoption. trackingonwithindexes,
"Errortable ");
}
Catch (sqlceexception ){
// Use you own error handling routine.
}
Finally {
// Dispose of the RDA object.
RDA. Dispose ();
}
Push transfers the changes in the extraction table tracked in the SQL Server ce database back to the SQL Server table.
String rdaoledbconnectstring = "provider = sqloledb; Data Source = mysqlserver; initial catalog = northwind;" +
"User ID = username; Password = <password> ";
// Initialize RDA object.
Sqlceremotedataaccess RDA = NULL;
Try {
// Try the pull operation.
RDA = new sqlceremotedataaccess ();
RDA. internetlogin = "mylogin ";
RDA. internetpassword = "<password> ";
RDA. interneturl = "http: // server IP Address/sscepubs/sscesaw.dll ";
RDA. localconnectionstring = @ "provider = Microsoft. sqlserver. oledb. ce.2.0; Data Source = \ SSCE. SDF ";
RDA. Push ("mylocaltable ",
Rdaoledbconnectstring,
Rdabatchoption. batchingon );
}
Catch (sqlceexception ){
// Use you own error handling routine.
}
Finally {
// Dispose of the RDA object.
RDA. Dispose ();
}
I just got started with PDA development. I don't know anything. I 'd like to explore it a little bit. Thank you!
(1) Installation . Net cf And SQL CE Components Netcf. Core. ppc3.arm. Cab System_sr_chs.cab Sqlce. ppc3.arm. Cab Sqlce. Dev. ppc3.arm. Cab SQL. ppc3.arm. Cab
Trackback: http://tb.blog.csdn.net/TrackBack.aspx? Postid = 1496651