1. Data Access with SQL Server 2005 Mobile Edition and the .NET Compact Framework v2.0 Scott Colestock
2.
3. Overview Device Data Access Native Stack Managed Stack SQL Server Mobile Edition CLR / .NET CF SQL Server CE Data Provider ADO.NET VB .NET / C# VS 2005 C++ OLEDB CE OLEDB Provider QP / Cursor Engine / ES Storage Engine / Replication Tracking
16. Synchronization Overall Architecture OLE DB SQL Mobile Client Agent HTTP OLE DB SQL Mobile Engine SQL Server OLE DB Provider SQL Mobile Server Agent Internet Information Services (IIS) Application Mobile Database SQL Server Database
17.
18.
19.
20.
21.
22. Remote Data Access Using RDA Pull Public Sub RDAPull() Dim rda as New SqlCeRemoteDataAccess Dim ServerOledbStr as String = “ Provider=sqloledb; Data Source=dataserver;” _ “ Initial Catalog=Pubs;User Id=sa;Password=;” rda.LocalConnectionString = ” Provider=Data Source=y Documentsest.sdf” ‘ Set URL and IIS login/password. rda.InternetUrl = “http://www.adventure-works.com/sqlmobile/sqlcesa30.dll” rda.Pull( “ Authors”, _ “ Select * from authors where state = ‘CA’”, _ ServerOledbStr, _ RdaTrackOption.TrackingOn) End Sub
23.
24. Remote Data Access Using RDA Push Public Sub RDAPush() Dim rda = New SqlCeRemoteDataAccess() Dim ServerOledbStr as String = “ Provider=sqloledb; Data Source=dataserver;” _ “ Initial Catalog=Pubs;User Id=sa;Password=;” rda.LocalConnectionString = _ ” Data Source=y Documentsest.sdf” ‘ Set URL and IIS login/password. rda.InternetUrl = “http://www.adventure-works.com/sqlmobile/sqlcesa30.dll” rda.Push( “ Authors”, ServerOledbStr, RdaBatchOption.BatchingOn) End Sub
25.
26.
27. Merge Replication Examining the Code Public Sub SyncSubscription() Dim repl as New SqlCeReplication() repl.InternetUrl = "http://Server1/SQLServerCE/sqlcesa30.dll" repl.Publisher = “SERVER1" repl.PublisherDatabase = “CustmerInfo" repl.PublisherLogin = "sa" repl.PublisherPassword = "" repl.Publication = "CustomerInfoPub" repl.SubscriberConnectionString = _ ” Data Source=y DocumentsyLocalDB.sdf“ repl.Subscriber = “CustomerInfoSub" repl.AddSubscription(AddOption.CreateDatabase) repl.Synchronize() End Sub