The "table" variable is my full loaded DataTable from the ServerDB.
So I try to delete the whole table in my mobile Ce DB and then to insert the data in this one.
The first time it works, the second time it fails because of the above mentioned primary key violation.
I think the DataTableAdapter should accept the changes after the insert and the table is cleared before refill the data.
_adpList[table.TableName].InsertCommand.Connection.Open();
new SqlCeCommand("Delete From " + table.TableName, (SqlCeConnection)_adpList[table.TableName].SelectCommand.Connection).ExecuteNonQuery();
_adpList[table.TableName].InsertCommand.Connection.Close();
for (int i = 0; i < table.Rows.Count; i++)
{
table.Rows[i].SetAdded();
}
int rows = _adpList[table.TableName].Update(table);