I have been trying to use OleDbDataAdapter to update a DataTable but got confused about the commands. Since I sometimes get info from diffr
You could use the String.Format Method to replace the @newVal1, @newVal2, ...
in your code, like this da.UpdateCommand = new OleDbCommand(String.Format("UPDATE TABLE_NAME SET (COL1, COL2, ...) VALUES ({0}, {1}, ...) WHERE id=@id",OBJECT_ARRAY_CONTAINING_VALUES_FROM_THEDG));
[Eidt per comment]
To handle the row[0]
, row[1]
you need a loop like:
for(i=0; i
da.UpdateCommand = new OleDbCommand(String.Format("UPDATE
...",row[i]);
da.Update(dt);
}