我正在尝试通过VB.NET Express 2010更新MS Access 2007数据库中的列。但是我的代码导致错误
更新语句中的0x80040E14语法错误
我不知道自己错误的地方。请帮我找到问题所在。
这是我的代码。
Dim ole As New OleDb.OleDbConnection
ole.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=""C:\Documents and Settings\Admin\My Documents\Visual Studio 2010\Projects\test\LM.accdb"";Jet OLEDB:Database Password=9876543210;"
Dim reader As New Integer
Dim query As New OleDb.OleDbCommand
Dim cmdUpdate As New OleDb.OleDbCommand
Dim queryString As String
Try
ole.Open()
queryString = "update security set password = '" + MaskedTextBox2.Text + "' where username = '"+ TextBox1.Text +"' "
query.CommandText = queryString
query.CommandType = CommandType.Text
query.Connection = ole
query.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.ToString())
Finally
ole.Close()
End Try
答案 0 :(得分:0)
试试这个:
queryString = "update security set [password] = '" + MaskedTextBox2.Text + "' where [username] = '"+ TextBox1.Text +"' "