jasonwucinski
Member
- Joined
- Mar 30, 2010
- Messages
- 8
- Programming Experience
- 1-3
hi everyone, I'm really hoping someone can help. this is my first attempt at making an OCA. when i insert my data into my local database, i do it like this:
This will insert the data into the table, but when i sync it, like this:
it wont sync, unless I save the data to the local db, then restart, and then sync. Is it because the data is just being saved to the DataSet and not being committed to the real DB until after restart? if so, how do i save the data to the Dataset, and then commit it to the real table?
thanks
jason
VB.NET:
Dim someName As String = Me.TextBox1.Text
Using connection As New SqlCeConnection("Data Source = D:\Visual Studio\Projects\Work_Link_New_Applicant\Work_Link_New_Applicant\dbWorkLink.sdf;" _
& "File Mode=Exclusive;")
Using command As New SqlCeCommand("INSERT INTO tblWorkLink_ID(WorklinkID) VALUES (@Name)", connection)
command.Parameters.AddWithValue("@Name", someName)
connection.Open()
command.ExecuteNonQuery()
End Using
End Using
This will insert the data into the table, but when i sync it, like this:
VB.NET:
Dim syncAgent As LocalDataCache1SyncAgent = New LocalDataCache1SyncAgent()
Dim syncStats As Microsoft.Synchronization.Data.SyncStatistics = syncAgent.Synchronize()
Me.DbWorkLinkDataSet.tblWorkLink_ID.Merge(TblWorkLink_IDTableAdapter.GetData())
it wont sync, unless I save the data to the local db, then restart, and then sync. Is it because the data is just being saved to the DataSet and not being committed to the real DB until after restart? if so, how do i save the data to the Dataset, and then commit it to the real table?
thanks
jason