K
Karch
OK, I've been staring and debugging for hours. Surely, someone else has run
into this problem. I have a typed dataset that contains 3 tables with
relationships between them. I need to insert the records for the first table
to get back the identity column for the subsequent inserts. However, after I
call UpdateDataSet the first time (and get back my identity and everything
cascades to the child tables just fine), the dataset returns false for
HasChanges() - meaning my subsequent inserts fail. How do I fix this
problem?
This is the code snippet that I have wrapped nicely in a try/catch block
with transactions. I have traced into the DAAB code and it looks like it
properly calls update using a dataadapter on the table only, and I cannot
see anywhere that AcceptChanges is called on the dataset. All help greatly
appreciated.
{
// this works just fine
rowsAffected = db.UpdateDataSet(
ds, TABLE_Company,
insertCommandCompany,
updateCommandCompany,
deleteCommandCompany, transaction);
// this thinks no changes and returns 0 rowsAffected
rowsAffected = db.UpdateDataSet(
ds, TABLE_EntityType,
insertCommandCompanyEntityType,
updateCommandCompanyEntityType,
deleteCommandCompanyEntityType, transaction)
// this thinks no changes and returns 0 rowsAffected
rowsAffected = db.UpdateDataSet(
ds, TABLE_Branch,
insertCommandBranch,
updateCommandBranch,
deleteCommandBranch, transaction);
}
into this problem. I have a typed dataset that contains 3 tables with
relationships between them. I need to insert the records for the first table
to get back the identity column for the subsequent inserts. However, after I
call UpdateDataSet the first time (and get back my identity and everything
cascades to the child tables just fine), the dataset returns false for
HasChanges() - meaning my subsequent inserts fail. How do I fix this
problem?
This is the code snippet that I have wrapped nicely in a try/catch block
with transactions. I have traced into the DAAB code and it looks like it
properly calls update using a dataadapter on the table only, and I cannot
see anywhere that AcceptChanges is called on the dataset. All help greatly
appreciated.
{
// this works just fine
rowsAffected = db.UpdateDataSet(
ds, TABLE_Company,
insertCommandCompany,
updateCommandCompany,
deleteCommandCompany, transaction);
// this thinks no changes and returns 0 rowsAffected
rowsAffected = db.UpdateDataSet(
ds, TABLE_EntityType,
insertCommandCompanyEntityType,
updateCommandCompanyEntityType,
deleteCommandCompanyEntityType, transaction)
// this thinks no changes and returns 0 rowsAffected
rowsAffected = db.UpdateDataSet(
ds, TABLE_Branch,
insertCommandBranch,
updateCommandBranch,
deleteCommandBranch, transaction);
}