错误代码 0x80040E14 更新语法错误
问题描述:
我正在尝试通过 VB.NET Express 2010 更新 MS Access 2007 数据库中的列.但我的代码导致错误
I am trying to update a column in a MS Access 2007 database via VB.NET Express 2010. But my code is causing an error
更新语句中的 0x80040E14 语法错误
0x80040E14 syntax error in update statement
我不知道我哪里做错了.请帮我找出问题所在.
I don't know where I had done mistake. Please help me in finding the problem.
这是我的代码.
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
答
试试这个:
queryString = "update security set [password] = '" + MaskedTextBox2.Text + "' where [username] = '"+ TextBox1.Text +"' "