4
Answers

Error: Input string was not in a correct format

Administrator

Administrator

21y
1.8k
1
Hi there I have an error when I'm trying to insert a record into a SQL Server Database. The problem is inserting an integer. I have dropdownlist which displays the CompanyName from one table and I want to insert their cmsId (an integer) into another table. I have set the DataTextField of the dropdownlist to be the CompanyName and the DataValueField to be their cmsID (an integer). I keep getting the following error message "Input string was not in a correct format." What does this mean? It's being mistaken for a string instead of an integer? How do I fix it? If I hardcode the integer into the SQL statement instead of using a parameter (see below), there is no problem at all.
View all
Forum Statistics
  • Please welcome our newest member Laura ken.

  • 2,380,775 users have contributed to 122,526 threads and 389,013

  • In the past 24 hours, we have  0 new threads, 3 new posts, and 19 new users.

  • In last week, the most popular thread is 'I am going to learn c#'.