Answered by:
changes not detected in sqlcompact sync

Question
-
hi all,
i am having trouble getting changes in my local db (sql compact 3.5 sp2) sync'd with my sql server 2008R2 database. I turned on verbose tracing on the app for the database, but i see nothing odd, other than "changes enumerated: 0".
I did notice that the primary key for the table was auto-numbering the entries starting at 0....so i entered one equipment record, key was 0, entered another equipment record, and the key was 1, but still none of these will sync with sql server and do an insert.
here are my references in my project:
Microsoft.synchronization v2.1.0.0
Microsoft.synchronization.data v2.0.0.0
Microsoft.synchronization.data.server v2.0.0.0
Microsoft.synchronization.data.sqlserverce v2.0.0.0
System.data.sqlserverce v3.5.1.0I can look at the SDF file, and all of the application's activity is saved in the local database, it just never detects anything to send back to the server.
any ideas what could this be?
~george
Monday, September 24, 2012 5:51 PM
Answers
-
the default configuration when you use Local Database Cache is download only synchronization.
if you want to do it bidirectional, have a look a this: Walkthrough: Extending the Local Database Cache to Support Bidirectional Synchronization
Wednesday, September 26, 2012 1:53 AM
All replies
-
which provider did your use? how did you provision the client database. does download to the client work?
Tuesday, September 25, 2012 2:53 AM -
provision?? i just added a local data cache in the project, added the tables from the server connection string, it created the local sdf file, synched the tables, and gave me the two lines of code to synchronize the databases.
Dim syncAgent As LocalDataCacheSyncAgent = New LocalDataCacheSyncAgent() Dim syncStats As Microsoft.Synchronization.Data.SyncStatistics = syncAgent.Synchronize()
obviously, there is more code around this checking connectivity and working mode.
provider? im not sure. it is hitting sql server 2008R2 (sqlclient) and my local sqlcompact 3.5sp2.
just to let you know, i have a little dialog that allows the user to "synchronize now"....and it will pull down the latest stuff from the sql server, but it just wont go the other way.
~george
Tuesday, September 25, 2012 7:59 PM -
the default configuration when you use Local Database Cache is download only synchronization.
if you want to do it bidirectional, have a look a this: Walkthrough: Extending the Local Database Cache to Support Bidirectional Synchronization
Wednesday, September 26, 2012 1:53 AM -
link didn't work.....but i copied the title out and searched and got it. i browsed this article and THANK YOU!
i kinda feel dumb for not reading this before :P
I'll give it a shot and write back.
thanks!
~george
- Edited by Ge0rg3 Wednesday, September 26, 2012 6:59 PM
Wednesday, September 26, 2012 4:52 PM -
yikes that worked well.....6400 changes uploaded and applied on the server. i hope i didn't loose anything....well i do have a backup from yesterday, so i guess i could always recover any lost info from that.
next question would be...how might i show which table it is currently synchronizing (for a progress indicator)? is that where the sync group comes in?
thanks again!
~george
Wednesday, September 26, 2012 8:58 PM -
have a look at the this sample, specifically the DisplaySessionProgress : How to: Work with Events and Program Business Logic
- Edited by JuneT Thursday, September 27, 2012 1:37 AM
Thursday, September 27, 2012 1:36 AM -
wow, i can't believe i haven't used this stuff before...it's amazing! thank you so much for pointing me in the right direction.
off topic: as far as that old connection string thing goes, i just decided to have two datasets in my project. one local and one server based. everything on forms bound to bindingsources. i created a base form class that does the following code on initialize:
If gobjData.WorkLocally Then For Each c As System.ComponentModel.Component In Me.components.Components If TypeOf c Is BindingSource Then Dim bs As BindingSource = DirectCast(c, BindingSource) bs.DataSource = Me.LocalDataset End If Next End If
so if the user "works locally" all forms switch the binding source over to the local dataset. this was painless to do. the only thing is...if i make a database change (add columns or whatever), i have to do it in two places, which isn't really that big of a deal.
thanks again!
~george
- Edited by Ge0rg3 Thursday, September 27, 2012 5:02 PM
Thursday, September 27, 2012 2:15 PM