locked
problem with sync using datset RRS feed

  • Question

  • I have the nest code writtin, but he doesn't sync.

    Can somebody please help me with this issue

    Public Class Form1
        Dim ds As New webawere_wouterDataSet.testDataTable
        Dim tijd = DateTime.UtcNow
        Dim tijdid = Format(tijd, "ymhmst")
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'TODO: This line of code loads data into the 'Webawere_wouterDataSet.test' table. You can move, or remove it, as needed.
            Me.TestTableAdapter.Fill(ds)
            ' Call SyncAgent.Synchronize() to initiate the synchronization process.
            ' Synchronization only updates the local database, not your project's data source
            DataGridView1.DataSource = ds
    
    
            ' TODO: Reload your project data source from the local database (for example, call the TableAdapter.Fill method).
    
        End Sub
        'add button
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim newCustomersRow As DataRow = ds.NewRow()
            newCustomersRow("ID") = tijdid
            newCustomersRow("naam") = Me.naamins.Text
            newCustomersRow("LastEditDate") = DateAndTime.Now
            newCustomersRow("CreationDate") = DateAndTime.Now
            ds.Rows.Add(newCustomersRow)
            Me.TableAdapterManager1.UpdateAll(Webawere_wouterDataSet)
            DataGridView1.Update()
        End Sub
    
        'sync button
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            Me.TestBindingSource.EndEdit()
            Try
                Dim syncAgent As LocalDataCache1SyncAgent = New LocalDataCache1SyncAgent()
                Dim syncStats As Microsoft.Synchronization.Data.SyncStatistics = syncAgent.Synchronize()
                logg.Text = syncStats.TotalChangesUploaded
                logdown.Text = syncStats.TotalChangesDownloaded
            Catch syncStats As Exception
                MsgBox(syncStats.Message)
            End Try
    
    
        End Sub
    End Class
    
    Saturday, January 16, 2010 9:12 AM

Answers

  • Wouter,

    Please check if your actual (local) database is getting the updates from the server.
    1) Insert a new record on the server
    2) Start your application and click Button2 (as per above code)
    3) Verify, using Visual Studio Server Explorer or Sql Server Management Studio that the new record has indeed been inserted into the client database.

    => if the record is not there, you will need to provide more details on how you have set up your solution. Even attempt to recreate the solution again using the Visual Studio 'Local Database Cache' item template, and retrying the 3 steps above.

    => if the record is there, Sync has worked, Jippie!!
         BUT as stated in the code: ' Synchronization only updates the local database, not your project's data source
         So after the Button2_Click, you need to call something like:
            Me.TestTableAdapter.Fill(ds)
            DataGridView1.DataSource = ds
         again, so that your data is refetched from the local database.

    HTH,

    Rudi
    ps: Het mag ook in het nederlands voor mij, doch de andere forum gebruikers hebben daar niet zoveel aan.
    Friday, February 12, 2010 12:50 PM

All replies

  • Would you please describe more about this issue.
    1. What sync scenario is this one?
    2. Which provider did you use in the sync app?

    Thanks.


    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, January 22, 2010 8:05 PM
    Answerer
  • What errors are you seeing here really?
    This posting is provided AS IS with no warranties, and confers no rights
    Friday, February 12, 2010 6:44 AM
  • Leo, I would expect more from a MSFT employee.

    1) This should give you a clue: Dim syncAgent As LocalDataCache1SyncAgent = New LocalDataCache1SyncAgent()
    2) Should be obvious from 1.
    Friday, February 12, 2010 12:42 PM
  • Mahesh, I don't think he is seeing an error.
    Friday, February 12, 2010 12:42 PM
  • Wouter,

    Please check if your actual (local) database is getting the updates from the server.
    1) Insert a new record on the server
    2) Start your application and click Button2 (as per above code)
    3) Verify, using Visual Studio Server Explorer or Sql Server Management Studio that the new record has indeed been inserted into the client database.

    => if the record is not there, you will need to provide more details on how you have set up your solution. Even attempt to recreate the solution again using the Visual Studio 'Local Database Cache' item template, and retrying the 3 steps above.

    => if the record is there, Sync has worked, Jippie!!
         BUT as stated in the code: ' Synchronization only updates the local database, not your project's data source
         So after the Button2_Click, you need to call something like:
            Me.TestTableAdapter.Fill(ds)
            DataGridView1.DataSource = ds
         again, so that your data is refetched from the local database.

    HTH,

    Rudi
    ps: Het mag ook in het nederlands voor mij, doch de andere forum gebruikers hebben daar niet zoveel aan.
    Friday, February 12, 2010 12:50 PM
  • Please also check the SyncDirection of the corresponding SyncTable in LocalDataCache1SyncAgent.

    Thanks.
    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, February 12, 2010 8:29 PM
    Answerer