G
Guest
I have the following code
iAdapter = new SqlDataAdapter();
iUpdater = new SqlCommandBuilder(iAdapter);
dsROCData = new DataSet("ROC");
SetConnection("XXXXX"); --> set the connection
oCommROC = new SqlCommand();
oCommROC.Connection = oConn;
oCommROC.CommandType = CommandType.StoredProcedure;
oCommROC.CommandText = "GetROCFromIFMS";
iAdapter.SelectCommand = oCommROC;
ifmsAdapter.MissingSchemaAction = MissingSchemaAction.Add;
int I = iAdapter.Fill(dsROCData, "ROCTemplatetable");
DataRow[] dr = ds.Tables["ROC"].Select();
foreach (DataRow d in dr)
{
dsROCData.Tables["ROCTemplatetable"].ImportRow(d);
}
if (dsROCData.HasChanges()
{
int j = iAdapter.Update(dsROCData,"ROCTemplatetable");
}
iAdapter.Dispose();
I keep getting an error:
"Concurrency violation: the UpdateCommand affected 0 records"
The Table I am trying to update has an autoincrement key so could this be
the issue?
Am I using this line of code correctly?
" ifmsAdapter.MissingSchemaAction = MissingSchemaAction.Add; "
Any help is appreciated
-Jawahar
iAdapter = new SqlDataAdapter();
iUpdater = new SqlCommandBuilder(iAdapter);
dsROCData = new DataSet("ROC");
SetConnection("XXXXX"); --> set the connection
oCommROC = new SqlCommand();
oCommROC.Connection = oConn;
oCommROC.CommandType = CommandType.StoredProcedure;
oCommROC.CommandText = "GetROCFromIFMS";
iAdapter.SelectCommand = oCommROC;
ifmsAdapter.MissingSchemaAction = MissingSchemaAction.Add;
int I = iAdapter.Fill(dsROCData, "ROCTemplatetable");
DataRow[] dr = ds.Tables["ROC"].Select();
foreach (DataRow d in dr)
{
dsROCData.Tables["ROCTemplatetable"].ImportRow(d);
}
if (dsROCData.HasChanges()
{
int j = iAdapter.Update(dsROCData,"ROCTemplatetable");
}
iAdapter.Dispose();
I keep getting an error:
"Concurrency violation: the UpdateCommand affected 0 records"
The Table I am trying to update has an autoincrement key so could this be
the issue?
Am I using this line of code correctly?
" ifmsAdapter.MissingSchemaAction = MissingSchemaAction.Add; "
Any help is appreciated
-Jawahar