Input string not in correct format... why?

Posted on 2011-10-27
Last Modified: 2013-12-16
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
Question by:rmmarsh
    LVL 22

    Accepted Solution


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

    LVL 22

    Expert Comment

    In this example, the Quantity value probably gives you an index to a (for example) text column.

    Author Closing Comment

    Thata was it!  Changed the format to "smallint" and it works now.

    Thank you very much!


    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
    Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now