Convert variable to integer

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
 
M

Marina Levit [MVP]

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top