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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top