Results 1 to 4 of 4

Thread: [RESOLVED] tutorial request

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2005
    Posts
    162

    Resolved [RESOLVED] tutorial request

    I need a tutorial on how to program for sql ce. i started this project awhile ago and had to hold it off until now. now i have forgotten what i was doing and had to start over. i have everything installed for ce. I have a database on the handheld created. now i just need to know how to get everythign syncronized. will it push when i sync? what kind of replication do i need to setup?

  2. #2
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: tutorial request

    For accessing remote sql server there are 2 options:

    1. RDA(Remote Data Access)
    2. Replication

    RDA allows you to pull down data from sql server to the device. All you need to do on the device is create the database. the Pull method of RDA will copy the table and the indexes for that table and automatically recreate them on the device.

    here is a example of rda

    RDA

    here is a tutorial on how to use replication

    replication
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2005
    Posts
    162

    Re: tutorial request

    VB Code:
    1. Private Sub sync()
    2.         Dim repl As SqlCeReplication = Nothing
    3.  
    4.         Try
    5.             ' Set the Replication object.
    6.             repl = New SqlCeReplication
    7.             repl.InternetUrl = "url"
    8.             repl.InternetLogin = "login"
    9.             repl.InternetPassword = "password"
    10.             repl.Publisher = "SQLSERV"
    11.             repl.PublisherDatabase = "receiving"
    12.             repl.PublisherLogin = "sa" 'a user to that database?
    13.             repl.PublisherPassword = "password"
    14.             repl.Publication = "receivingPUB" 'name of publication?
    15.             repl.SubscriberConnectionString = "Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\my documents\receiving.sdf" 'location of databse on pocket pc?
    16.             repl.Subscriber = "*" 'i have no idea what to put here
    17.  
    18.             ' Create the Local SSCE Database subscription.
    19.             repl.AddSubscription(AddOption.CreateDatabase)
    20.  
    21.             ' Synchronize to the instance of SQL Server 2000 to populate the Subscription.
    22.             repl.Synchronize()
    23.  
    24.         Catch err As SqlCeException
    25.             ' Use your own error handling routine to show error information.
    26.             ' ShowErrors(e)
    27.  
    28.         Finally
    29.             ' Dispose of the Replication object.
    30.             repl.Dispose()
    31.         End Try
    32.  
    33.     End Sub
    could someoen tell me i am doing wrong. it looks like I am missing the connection stuff like in normal windows apps? I had one and it gave me errors.
    I dont understand the RDA link. it looked the same, but he had variables undeclared and i had no idea how to fix them. it looks like this pull subscription makes the connection all at once. I actually pull down the database. i know this because i deleted it and it created it in the right spot. the problem is that it only pulled a few sys tables.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2005
    Posts
    162

    Re: tutorial request

    i am totally redoing this code. it turns out my code isnt really the problem. it is my connection with the sql server. once i get the connection and the snapshot right, it should be fine. it is funny that this really isnt my fault, just the setup on the sql server.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width