Input string not in correct format... why?

I have a column in a database that is defined as small int, with a value of 1.  I am getting an error on this code:

 
tbCopies.Text = data.GetInt16((int)tBooks.Quantity).ToString();

Open in new window


The error is "Input string not in correct format".  Why
rmmarshAsked:
Who is Participating?
 
pivarConnect With a Mentor Commented:
Hi,

GetInt16 expects the index of the smallint column in the table. Quantity is just a value?

/peter
0
 
pivarCommented:
In this example, the Quantity value probably gives you an index to a (for example) text column.
0
 
rmmarshAuthor Commented:
Thata was it!  Changed the format to "smallint" and it works now.

Thank you very much!

Rolf
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.