从 Access 数据库更新到 C# 中的文本框时尝试仅获取数字
我刚刚开始使用 C#,并且表单上有一个文本框。我只想显示 ACCESS 数据库中的数字,就像存储在数据库中的字符串是 12Kg 但当我更新时我应该只返回值 ie12,我已经搜索但没有得到任何想法,我希望你能帮助我...
查询:
"Update Para Set PartNumber = '"+ txtPartNoL.Text + "', MacID = '" + cmb.SelectedValue.ToString() + "'"+" Para1 = '" + txtPara1L.Text + "', PType1 = '" + lblLPara1.Text + "'," + " val(LabourPara.Para4) = '" + txtPara4L.Text + "', PType4 = '" + lblLPara4.Text + "'," + " Qty = '" + txtQtyL.Text + "', PF = '" + txtPFL.Text + "', SF = '" + txtSFL.Text + "'," + " Amount = '" + txtAmt.Text + "'" + " WHERE QoNumber = '" + txtNo.Text + "' AND PartNumber = '" + txtPartNo.Text + "'";
I just started using C# and I a have a textbox on a form. I want to display only numbers from ACCESS database, Like string stored in database is 12Kg but when I do update i should return only value i.e.12, I have searched but not getting any idea, I hope you can help me...
Query:
"Update Para Set PartNumber = '"+ txtPartNoL.Text + "', MacID = '" + cmb.SelectedValue.ToString() + "'"+" Para1 = '" + txtPara1L.Text + "', PType1 = '" + lblLPara1.Text + "'," + " val(LabourPara.Para4) = '" + txtPara4L.Text + "', PType4 = '" + lblLPara4.Text + "'," + " Qty = '" + txtQtyL.Text + "', PF = '" + txtPFL.Text + "', SF = '" + txtSFL.Text + "'," + " Amount = '" + txtAmt.Text + "'" + " WHERE QoNumber = '" + txtNo.Text + "' AND PartNumber = '" + txtPartNo.Text + "'";
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在将所有内容更新为文本,这至少对于数量和金额而言是不可能的,因此请尝试:
但是,请避免这种连接混乱,并且 - 尽快 - 去学习如何使用参数。
You are updating everything as text, which can't be true for at least quantity and amount, so try:
However, avoid this concatenating mess and - asap - go and learn how to use parameters.