G
Guest
string updateSQL;
updateSQL = "UPDATE TestDetails SET AnsweredWordID =
:AnsweredWordID WHERE RID=:RID";
OleDbCommand command = new OleDbCommand();
command.CommandText = updateSQL;
OleDbParameter param1 = new OleDbParameter(":AnsweredWordID",
OleDbType.Integer, 0, "AnsweredWordID");
command.Parameters.Add(param1);
OleDbParameter param2 = new OleDbParameter(":RID",
OleDbType.Integer);
param2.SourceVersion = DataRowVersion.Current;
param2.SourceColumn = "RID";
command.Parameters.Add(param2);
m_DataTableTestDetails.Rows[m_Position]["AnsweredWordID"] = 99;
OleDbDataAdapter adapter = new OleDbDataAdapter();
OpenConnection();
adapter.UpdateCommand = command;
adapter.UpdateCommand.Connection = m_Connection;
adapter.Update(m_DataTableTestDetails);
CloseConnection();
There is an exception when
adapter.Update(m_DataTableTestDetails); line. The exception is ":RID No value
given for one or more required parameters".
I need help pls. Thanks alot.
updateSQL = "UPDATE TestDetails SET AnsweredWordID =
:AnsweredWordID WHERE RID=:RID";
OleDbCommand command = new OleDbCommand();
command.CommandText = updateSQL;
OleDbParameter param1 = new OleDbParameter(":AnsweredWordID",
OleDbType.Integer, 0, "AnsweredWordID");
command.Parameters.Add(param1);
OleDbParameter param2 = new OleDbParameter(":RID",
OleDbType.Integer);
param2.SourceVersion = DataRowVersion.Current;
param2.SourceColumn = "RID";
command.Parameters.Add(param2);
m_DataTableTestDetails.Rows[m_Position]["AnsweredWordID"] = 99;
OleDbDataAdapter adapter = new OleDbDataAdapter();
OpenConnection();
adapter.UpdateCommand = command;
adapter.UpdateCommand.Connection = m_Connection;
adapter.Update(m_DataTableTestDetails);
CloseConnection();
There is an exception when
adapter.Update(m_DataTableTestDetails); line. The exception is ":RID No value
given for one or more required parameters".
I need help pls. Thanks alot.