当前位置:编程学习 > C#/ASP.NET >>

varchar类型如何转为numeric类型出错

我写的sql语句
update 学生 set 成绩='" & TextBox1.Text & "'  where 学号=" & TextBox2.Text & ""
出现“varchar类型如何转为numeric类型出错”的报错,我在表里成绩字段定义为numeric类型,请问是怎么回事,应该怎么改啊? --------------------编程问答-------------------- update 学生 set 成绩='" & TextBox1.Text & "'  where 学号=" & cstr(TextBox2.Text)
--------------------编程问答-------------------- update 学生 set 成绩=" & TextBox1.Text & "  where 学号=" & TextBox2.Text & ""  --------------------编程问答-------------------- 武汉地区招聘.NET程序员,有中级证的2000-3000,高级证的3000-5000,具体视能力来定。 
联系电话:02787138803 --------------------编程问答--------------------
引用 2 楼 yanlongwuhui 的回复:
update 学生 set 成绩=" & TextBox1.Text & "  where 学号=" & TextBox2.Text & "" 

--------------------编程问答-------------------- update 学生 set 成绩=" & TextBox1.Text & "  where 学号=' " & TextBox2.Text & " '"  --------------------编程问答-------------------- 我把成绩填入textbox1中,把学号填入textbox2中,由于textbox.text是varchar类型的,而我数据库里面的字段是numeric --------------------编程问答-------------------- 学号为numeric:
"update 学生 set 成绩=" & TextBox1.Text & "  where 学号=" & TextBox2.Text & "" 
学号为varchar:
"update 学生 set 成绩=" & TextBox1.Text & "  where 学号='" & TextBox2.Text & "'" 
补充:.NET技术 ,  VB.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,