tpra21
Active member
- Joined
- Oct 21, 2006
- Messages
- 26
- Programming Experience
- 1-3
I am trying to update two rows in a table based on the ReminderID, which is selected by the user from a ComboBox. The COmboBox is binded to the ReminderID field in the Reminders table. The following is the code in Error:
Dim StrUpdate AsString = "UPDATE Reminders SET DueDate = ? , Message = ? WHERE ReminderID = ?"
Dim cmdUpdate AsNew System.Data.OleDb.OleDbCommand(StrUpdate, OleDbConnection2)
cmdUpdate.Parameters.Add("@ReminderID", System.Data.OleDb.OleDbType.Integer, 0, "ReminderID").Value = ComboBox1.SelectedItem
cmdUpdate.Parameters.Add("@Message", System.Data.OleDb.OleDbType.VarWChar, 255, "Message").Value = txtMessage.Text
cmdUpdate.Parameters.Add("@DueDate", System.Data.OleDb.OleDbType.VarWChar, 255, "DueDate").Value = txtDate.Text
I am getting the following exception/error:
System.InvalidCastException: Object must implement IConvertible.
I think the error corresponds to the "value" statements at the end of my parameters, but not sure.
Any help would be awesome.
Thanks, Adam
Dim StrUpdate AsString = "UPDATE Reminders SET DueDate = ? , Message = ? WHERE ReminderID = ?"
Dim cmdUpdate AsNew System.Data.OleDb.OleDbCommand(StrUpdate, OleDbConnection2)
cmdUpdate.Parameters.Add("@ReminderID", System.Data.OleDb.OleDbType.Integer, 0, "ReminderID").Value = ComboBox1.SelectedItem
cmdUpdate.Parameters.Add("@Message", System.Data.OleDb.OleDbType.VarWChar, 255, "Message").Value = txtMessage.Text
cmdUpdate.Parameters.Add("@DueDate", System.Data.OleDb.OleDbType.VarWChar, 255, "DueDate").Value = txtDate.Text
I am getting the following exception/error:
System.InvalidCastException: Object must implement IConvertible.
I think the error corresponds to the "value" statements at the end of my parameters, but not sure.
Any help would be awesome.
Thanks, Adam