J
Joe Delphi
Hi,
I am attempting to do an INSERT operation using the OleDBCommand
object. I am receiving this error message:
"Object must implement IConvertible"
Here is the part of my code where the error occurs:
Dim cmdInsert As System.Data.OleDb.OleDbCommand
cmdInsert = Me.daChangeRequests.InsertCommand
With cmdInsert
.Parameters(0).Value = Me.txtTitle.Text
.Parameters(1).Value = Me.txtDescription.Text
.Parameters(2).Value = Me.ddlstPriority.SelectedItem
.Parameters(3).Value = Me.ddlstStatus.SelectedItem
.Parameters(4).Value = Me.ddlstSubBy.SelectedItem
.Parameters(5).Value = Today
.Parameters(6).Value = Me.txtNotes.Text
.Parameters(7).Value = Me.ddlstStatus.SelectedItem
.Parameters(8).Value = Me.txtDateFixed.Text
End With
'Now INSERT the record into the database, and let the user
'know if something went wrong with the INSERT.
cnChangeRequests.Open()
Try
cmdInsert.ExecuteNonQuery()
Me.lblSaved.ForeColor = White
Me.lblSaved.Text = "CR successfully saved."
Catch
Me.lblSaved.ForeColor = Red
Me.lblSaved.Text = Err.Description
cnChangeRequests.Close()
Exit Sub
End Try
cnChangeRequests.Close()
Can anyone tell me what I am doing wrong?
JD
I am attempting to do an INSERT operation using the OleDBCommand
object. I am receiving this error message:
"Object must implement IConvertible"
Here is the part of my code where the error occurs:
Dim cmdInsert As System.Data.OleDb.OleDbCommand
cmdInsert = Me.daChangeRequests.InsertCommand
With cmdInsert
.Parameters(0).Value = Me.txtTitle.Text
.Parameters(1).Value = Me.txtDescription.Text
.Parameters(2).Value = Me.ddlstPriority.SelectedItem
.Parameters(3).Value = Me.ddlstStatus.SelectedItem
.Parameters(4).Value = Me.ddlstSubBy.SelectedItem
.Parameters(5).Value = Today
.Parameters(6).Value = Me.txtNotes.Text
.Parameters(7).Value = Me.ddlstStatus.SelectedItem
.Parameters(8).Value = Me.txtDateFixed.Text
End With
'Now INSERT the record into the database, and let the user
'know if something went wrong with the INSERT.
cnChangeRequests.Open()
Try
cmdInsert.ExecuteNonQuery()
Me.lblSaved.ForeColor = White
Me.lblSaved.Text = "CR successfully saved."
Catch
Me.lblSaved.ForeColor = Red
Me.lblSaved.Text = Err.Description
cnChangeRequests.Close()
Exit Sub
End Try
cnChangeRequests.Close()
Can anyone tell me what I am doing wrong?
JD