Im trying to code a custom oledbDataAdapter to update a foxpro table. (The commandbuilder wont work in this instance.) My update code follows:
string lcSQL = "UPDATE emp SET emp_name=?, emp_cost=? where emp_id=?";
OleDbDataAdapter1.UpdateCommand = new OleDbCommand(lcSQL,this.oleDbConnection1);
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@emp_name", OleDbType.Char, 35,"emp_name");
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@emp_cost", OleDbType.Numeric, 10,"emp_cost");
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@emp_id", OleDbType.Char, 4,"emp_id");
When I "oleDbDataAdapter1.Update" with the dataset, I get a "Object Reference Not Set to an instance of an object".
If I omit the "emp_cost" field, I dont get the error. Ive tried changing the OleDbType.Numeric length to -0- (I read somewhere), but still the same thing.
Anybody?
string lcSQL = "UPDATE emp SET emp_name=?, emp_cost=? where emp_id=?";
OleDbDataAdapter1.UpdateCommand = new OleDbCommand(lcSQL,this.oleDbConnection1);
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@emp_name", OleDbType.Char, 35,"emp_name");
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@emp_cost", OleDbType.Numeric, 10,"emp_cost");
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@emp_id", OleDbType.Char, 4,"emp_id");
When I "oleDbDataAdapter1.Update" with the dataset, I get a "Object Reference Not Set to an instance of an object".
If I omit the "emp_cost" field, I dont get the error. Ive tried changing the OleDbType.Numeric length to -0- (I read somewhere), but still the same thing.
Anybody?