我正在努力让我的 sql 数据库从我的网站页面上的文本框中接受小数。当我输入一个整数时没有问题,只有当我输入一个小数 (123.45) 时,我才会遇到问题。我已经尝试过double.parse(textbox.text)
,decimal.parse(textbox.text)
但无济于事。
我收到错误消息
输入字符串的格式不正确
我的插入语句如下:
"INSERT INTO Transactions (Date, Account, Payee, Chq_Num, Reference, GST_Rate,
Amount, Document_Number, Bank_Account) VALUES ('" & yy & "-" & mm & "-" & dd &
"','" & DropDownList3.SelectedValue & "','" & TextBox3.Text & "','" &
TextBox5.Text & "','" & TextBox4.Text & "'," & DropDownList2.SelectedValue &
"," & Double.Parse(TextBox6.Text) & "," & TextBox27.Text & ",'" &
DropDownList1.SelectedValue & "'); INSERT INTO Cash (Date, Bank_Account,
Amount, Document_Number) VALUES ('" & yy & "-" & mm & "-" & dd & "','" &
DropDownList1.SelectedValue & "'," & Double.Parse(TextBox2.Text) & "," &
TextBox27.Text & ");"
我的数据库字段设置为十进制(18,2)有什么想法吗?