如何清除语法错误呢 [英] how can clear syntax error this
本文介绍了如何清除语法错误呢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
' 下一步创建命令
Dim CMD3 As 新 OleDb.OleDbCommand
SQL = insert into reciptdetails
(Reciptid,Barcode,Itemcount,Itembuyprice,Itemsellprice)
values
(:0,: 1,:2,:3,:4)
解决方案
看起来你正在构建一个字符串多个部分。为此你必须使用连接:
SQL = insert into reciptdetails +
(Reciptid,Barcode,Itemcount,Itembuyprice,Itemsellprice) +
values +
(:0,:1,:2,:3,:4)
Dim CMD3 As < span class =code-keyword>新 OleDb.OleDbCommand
Dim Sql As 字符串
Sql = insert into reciptdetails +
(Reciptid,Barcode,Itemcount,Itembuyprice,Itemsellprice) +
值 +
(:0,:1,:2,:3,:4 )
解决方案1和2缺少一个细节:
- 你需要添加每个SQL命令末尾的空格
SQL = insert into reciptdetails +
(Reciptid,Barcode,Itemcount, Itembuyprice,Itemsellprice) +
values +
(:0,:1,:2,:3,:4)
' next create a command
Dim CMD3 As New OleDb.OleDbCommand
SQL = "insert into reciptdetails"
"(Reciptid,Barcode,Itemcount,Itembuyprice,Itemsellprice)"
"values"
"(:0 ,:1 ,:2 ,:3 ,:4 )"
解决方案
It looks like you're building a string from multiple parts . For this you have to use concatenation:
SQL = "insert into reciptdetails" + " (Reciptid,Barcode,Itemcount,Itembuyprice,Itemsellprice)" + " values" + " (:0 ,:1 ,:2 ,:3 ,:4 )"
Dim CMD3 As New OleDb.OleDbCommand Dim Sql As String Sql = "insert into reciptdetails" + "(Reciptid,Barcode,Itemcount,Itembuyprice,Itemsellprice)" + "values" + "(:0 ,:1 ,:2 ,:3 ,:4 )"
Solutions 1 and 2 are missing a detail:
- you need to add a space at the end of each pieces of the SQL command
SQL = "insert into reciptdetails " + "(Reciptid,Barcode,Itemcount,Itembuyprice,Itemsellprice) " + "values " + "(:0 ,:1 ,:2 ,:3 ,:4 )"
这篇关于如何清除语法错误呢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文