Posted on: 9/28/2015 11:43:35 AM | Views : 874


when i updating datatable using oledbadapter its giving  object reference null exception same code for insert  by replacing commandtext and insert command its working fine
what is the problem for this code
da.openConnection();
OleDbCommand cmdObj = new OleDbCommand(); cmdObj.CommandType = CommandType.Text; // cmdObj.Connection = da.conDform; cmdObj.CommandText ="update final_sekhar set grade=:grade where finalmarksid=:finalmarksid";
OleDbDataAdapter adp1 = new OleDbDataAdapter();
adp1.UpdateCommand.Parameters.Add(":grade", OleDbType.VarChar, 30, "grade"); adp1.UpdateCommand.Parameters.Add(":finalmarksid", OleDbType.Integer,10, "finalmarksid"); OleDbCommandBuilder ocb = new OleDbCommandBuilder(adp1); adp1.Update(newdb); da.closeConnection();

Go to the complete details ...