Tampilkan postingan dengan label ADO.NET Synchronization. Tampilkan semua postingan
Tampilkan postingan dengan label ADO.NET Synchronization. Tampilkan semua postingan

Rabu, 20 Februari 2008

Why My table doesn't appear on Local Data Chace Designer

1.Are not in the user’s default schema.

Note:
To determine which schema is being displayed, inspect the text above the list of tables. The text appears in the following format: Tables on 'DatabaseName.SchemaName'. The SchemaName listed is the current default schema. For information about default schemas, see User-Schema Separation in SQL Server 2005 Books Online.


2.Table Doensn't have a primary key defined.

3.Have names longer than 118 characters.

4.Contain columns with data types that are not supported by SQL Server Compact 3.5.

Handle Data Conflicts and Errors ADO.NET Synchronization

partial class LocalDataCache1ServerSyncProvider
{
protected override void OnChangesSelected(ChangesSelectedEventArgs value)
{
base.OnChangesSelected(value);


}
public override SyncContext GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
{
return base.GetChanges(groupMetadata, syncSession);
MessageBox.Show(groupMetadata.BatchCount + " Change");
}
protected override void OnSelectingChanges(SelectingChangesEventArgs value)
{
base.OnSelectingChanges(value);

}
protected override void OnApplyChangeFailed(Microsoft.Synchronization.Data.ApplyChangeFailedEventArgs value)
{
DataTable clientchanges = value.Conflict.ClientChange;
DataTable serverchanges = value.Conflict.ServerChange;
if(value.Conflict.ConflictType==ConflictType.ClientUpdateServerDelete)
{


value.Action = ApplyAction.RetryWithForceWrite;


}
if (value.Conflict.ConflictType == ConflictType.ClientInsertServerInsert)
{
value.Action = ApplyAction.RetryWithForceWrite;
}

if (value.Conflict.ConflictType == ConflictType.ClientUpdateServerUpdate)
{
//Logic goes here.
Form1 a = new Form1();
a.ultraGrid1.DataSource = serverchanges;
a.ultraGrid2.DataSource = clientchanges;
a.ultraStatusBar1.Text = "Data has been changed by other user since your last synchronization";
a.ShowDialog();
value.Action = a.action;
}

if (value.Conflict.ConflictType == ConflictType.ErrorsOccurred)
{
//Logic goes here.
MessageBox.Show(value.Conflict.ErrorMessage, "UnKnown Error Happened:Continuing");

}

}
protected override void OnApplyingChanges(ApplyingChangesEventArgs value)
{
DataSet clientchanges = value.Changes;
}
}