Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object must implement IConvertible.

Status
Not open for further replies.

qwert231

Programmer
Sep 4, 2001
756
US
I receive this message while doing an .ExecuteNonQuery() method on a command:
System.InvalidCastException: Object must implement IConvertible.

It seems to happen when it starts looking at the Command's parameters. Here is where I build them:
Code:
' Adding the parameters.
  Dim cmd As New OleDbCommand(strSQL.ToString, Me.conAccs)
  Dim pc As OleDbParameterCollection = cmd.Parameters
  myStr = Me.lblOrderNum.Text
  pc.Add("OrderID", OleDbType.Integer).Value = CType(myStr, Int32)
  pc.Add("SubjectID", OleDbType.Char).Value = Me.lbSubject.SelectedItem
  For Each _item In Me.dgPrntSize.Items
   If CType(_item.Cells(0).FindControl(&quot;tbQty&quot;), TextBox).Text <> &quot;&quot; Then
    Me.testInt = CType(CType(_item.Cells(0).FindControl(&quot;tbQty&quot;), TextBox).Text, Int32)
    i = _item.ItemIndex
    pc.Add(Me.dsWed.Tables(&quot;Sizes&quot;).Rows(i).Item(&quot;packName&quot;), OleDbType.Integer).Value = CType(_item.Cells(0).FindControl(&quot;tbQty&quot;), TextBox).Text
   End If
  Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top