如何使用vb.net插入MDB?
Dim MyInsert As String = "INSERT INTO Inventory(userid,
Type,Number) Values(" & _
txtEquipCat.text & "," & _
Type.Text & "," & _
Number.text & ")"
在执行此操作时,我得到了
语法错误:插入到语句
错误。
如何在MDB中插入类型和数字等关键字? 我想在插入时指定列名。
Dim MyInsert As String = "INSERT INTO Inventory(userid,
Type,Number) Values(" & _
txtEquipCat.text & "," & _
Type.Text & "," & _
Number.text & ")"
while executing this im getting
syntax error:Insert in to statement
error.
How to insert keywords like type and number in to MDB?
I want to specify the columnname while insert.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,使用参数。其次,您的字符串混合物没有在文本周围添加“引号”。
也就是说,
VALUES ('" & txtEquipCat.Text & "',...
但不要尝试像这样修复它。
使用参数:
VALUES (?, ?, ?)
注意,对于参数,您不必担心任何引号。参数必须按顺序输入,因此第一个“?”对应于 txtEquipCat,第二个对应于 Type.Text,等等。
First of all, use parameters. Secondly, your string concoction isn't putting "quotes" around the text.
That is,
VALUES ('" & txtEquipCat.Text & "',...
Don't try to fix it like that though.
Use parameters:
VALUES (?, ?, ?)
Notice with parameters, you do not have to worry about any quotation marks. The parameters have to be entered in order, so the first "?" corresponds to txtEquipCat, the second to Type.Text, etc.