Convert variable to integer

  • Thread starter Thread starter staeri
  • Start date Start date
S

staeri

I need to input a stored procedure parameter as an integer but the
conversion doesn't work. I get the error message "Input string was not
in a correct format." I'm using the following code:

Dim intObjectID As Integer = Convert.ToInt32(row.Cells(0).Text)

With myCommand
..Parameters.Add(New SqlParameter("@ObjectID", SqlDbType.Int))
..Parameters("@ObjectID").Value = intObjectID

Can someone please help me?

// S
 
It looks like the text in that cell was not a valid integer. You can't
convert a string that doesn't contain an integer into one.
 
Back
Top