Help with Dataset update

Xcoder

New member
Joined
Sep 8, 2006
Messages
1
Programming Experience
Beginner
How do I manually set the UpdateCommand in a DataAdapter? Care to post an example?

Im using a mdb file and I cant seem to make it work, the main problem comes from the fact that the table is named -general- which is a restricted word in SQL, when I do the Select statement to fill up the DataSet, I have no problems because I close the word in brackets, but using a CommandBuilder, it wont enclose it.
 
why not name it something else?

Also, I'm not sure why you cannot do this:

VB.NET:
Dim sqlCmd as New OleDbCommand("UPDATE [-General-] SET a = ?, b = ? WHERE c = ?")
sqlCmd.Parameters.Clear()
sqlCmd.Parameters.Add(... whatever needed to fill out those ? marks...)
 
myDataAdapter.UpdateCommand = sqlCommand;

Also, I never heard of -General- being a reserved word in sql... Maybe it is access specific, but i cant imagine any DB vendor having hypenGeneralhyphen as a reserved word
 
Back
Top