Primary key modification and Update
I want to be able to modify and correct a primary key :
[CODE]
string CommandText =
"UPDATE " + nameTable +
" SET IDObj=@IDObj , NameParent=@NameParent,TypeObj=@TypeObj"+
" WHERE IDObj=@IDObjOrig";
//IDObj : Primary key
//NameParent,TypeObj : the two other columns.
//comdUPDATE : is my Command.
//declaration of parameters
comdUPDATE.Parameters.Add(new OleDbParameter("@IDObjOrig", OleDbType.VarChar, 50));
comdUPDATE.Parameters.Add(new OleDbParameter("@IDObj", OleDbType.VarChar,50));
comdUPDATE.Parameters.Add(new OleDbParameter("@NameParent", OleDbType.VarChar,50));
comdUPDATE.Parameters.Add(new OleDbParameter("@TypeObj",OleDbType.VarChar, 50));
comdUPDATE.Parameters["@IDObjOrig"].SourceVersion =DataRowVersion.Original;
comdUPDATE.Parameters["@IDObj"].SourceVersion = DataRowVersion.Current;
comdUPDATE.Parameters["@NameParent"].SourceVersion= DataRowVersion.Current;
comdUPDATE.Parameters["@TypeObj"].SourceVersion= DataRowVersion.Current;
comdUPDATE.Parameters["@IDObjOrig"].SourceColumn = "IDObj";
comdUPDATE.Parameters["@IDObj"].SourceColumn = "IDObj";
comdUPDATE.Parameters["@NameParent"].SourceColumn = "NameParent";
comdUPDATE.Parameters["@TypeObj"].SourceColumn = "TypeObj";
con.Open();
// con is my OLE connection
DAdp.Update(DS.Tables[nameTable]);
//DAdp is my DataAdapter
//DS is My dataSet
//nameTable : a string containing the name of my Table.
con.Close();
[CODE]
I have this exception : (Concurrency violation : the update command affected 0 of the expected 1 records). ???? But i did not introduced two similar "IDObj"
how is it possible to modify a primary key witch is the reference of that modified row?
HELP!!!!