如何解决“INSERT INTO 语句的语法错误”(VB.net中)?

DimsNameAsString=cob_标准名称.TextDimsNumberAsString=CommonUtil.GetNewNumber()DimCsinkAsS... Dim sName As String = cob_标准名称.Text
Dim sNumber As String = CommonUtil.GetNewNumber()
Dim Csink As Single = CSng(txt_C标准值.Text)
Dim Cupper As Single = CSng(txt_C上偏差.Text)
Dim Clower As Single = CSng(txt_C下偏差.Text)
Dim OL As Single = CSng(txt_迭接长度.Text)
Dim OLP As Single = CSng(txt_迭接率.Text)
Dim Gap As Single = CSng(txt_间隙长度.Text)
Dim usingConditon As String = txt_适用范围.Text
If MessageBox.Show("是否添加此标准?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.Yes Then
Dim conn As New OleDbConnection
conn.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & Path.Combine(Application.StartupPath, "db\二重卷边数据管理2003.mdb")
conn.Open()
Dim cmdText As String
Dim cmd As New OleDbCommand
cmdText = "Insert Into 二重卷边标准管理(标准编号, 标准名称, 埋头度C, C上偏差, C下偏差, 迭接长度OL, 迭接率OL%, 间隙长度G, 适用范围) Values('" & sNumber & _
"', '" & sName & "', " & Csink & "," & Cupper & " ," & Clower & "," & OL & "," & OLP & "," & Gap & ",'" & usingConditon & "')"
cmd.CommandText = cmdText
cmd.Connection = conn
cmd.ExecuteNonQuery()
conn.Close()
Else
btn_添加.Dispose()
End If

调试运行时总是提示INSERT INTO 语句的语法错误,找了很久都不知道错在哪里,请大家帮帮忙
展开
 我来答
SIANGKEE
2012-05-12 · TA获得超过1552个赞
知道小有建树答主
回答量:1033
采纳率:50%
帮助的人:822万
展开全部
cmdText = "Insert Into 二重卷边标准管理(标准编号, 标准名称, 埋头度C, C上偏差, C下偏差, 迭接长度OL, 迭接率OL%, 间隙长度G, 适用范围) Values('" & sNumber & _
"', '" & sName & "', " & Csink & ",'" & Cupper & "' ,'" & Clower & "','" & OL & "','" & OLP & "','" & Gap & "','" & usingConditon & "')"
追问
您是说把Values后面的" " 都改为'" "' 是吗,我之前就是这样写的,但是任然说INSERT INTO 语句的语法错误,于是我就上网查了查,说数字型的用" " ,我就改了改,但是还是不行,在字段名上加[ ],也不行。真的是不知道该怎么办。还请帮帮忙呀。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式