bwgc Posted May 25, 2003 Posted May 25, 2003 I'm trying to code a custom oledbDataAdapter to update a foxpro table. (The commandbuilder won't 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 don't get the error. I've tried changing the OleDbType.Numeric length to -0- (I read somewhere), but still the same thing. Anybody? Quote
wyrd Posted May 25, 2003 Posted May 25, 2003 Perhaps one of the rows being updated has a null emp_cost field? That's what I would assume from the error message being provided. Quote Gamer extraordinaire. Programmer wannabe.
bwgc Posted May 25, 2003 Author Posted May 25, 2003 That's not the case. It's a very small dbf. No null values either in the source or destination. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.