我将文本框中的值保存回数据库。如何将输入到文本框中的数字保存回数据库。我曾尝试以下,但得到一个错误说Input string was not in a correct format
INT到字符串 - 从文本框保存回数据库
newCarsRow.CustomerID = Convert.ToInt32(TextBox5.Text);
//I have also tried
newCarsRow.CustomerID = int.Parse(TextBox5.Text);
我保存文本输入到文本框,像这样
newCarsRow.Surname = TextBox1.Text.ToString();
customerid是数字字段吗? – matzone 2013-05-13 10:01:34
你在TextBox5.Text中得到了什么,它不是数字 – Habib 2013-05-13 10:01:36
你输入了什么数字?您还必须通过设置DBNull值分别处理空值。 – 2013-05-13 10:01:41