本文介绍了VB 2010 INSERT INTO语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,下午好,我在VB.Net中有一个程序,将从文本框中输入数据
到Access数据库中,这里是示例图像

Hello Good Afternoon I have a program in VB.Net that will Input datafrom textboxes into Access Database here is sample image

这是我正在使用的代码,它给了我一个错误

This is the code I am using and it gives me an error

m = TextBox1.Text
b = "'" + TextBox2.Text + "'"
x = "'" + TextBox3.Text + "'"
d = TextBox4.Text
n = "'" + TextBox5.Text + "'"
Dim s2 As String
s2 = "insert into users2 ( num , name1 , pass , add , phone ) " & " values ( " + m + " , " + n + " , " + b + " , " + x + " , " + d + " ) "
Dim cmd2 As New OleDbCommand(s2, con)
cmd2.ExecuteNonQuery()

期待自我的程序开始以来,有人会启发我的问题。

Looking forward that someone will enlighten my problem since its im starting to program.

TYSM以获取将来的帮助

TYSM for future help

推荐答案


  1. 您需要封装要插入到''

中的值。 values(' + m +',' + ...

. "values('" + m + "', '" + ...

2我不理解开头的查询两部分之间的&运算符

2 I don't understand & operator between two parts of query in the beginning

这篇关于VB 2010 INSERT INTO语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 01:07