Error Code 0x80040E14 update syntax error

不想你离开。 提交于 2020-03-25 22:17:10

问题


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 syntax error in update statement

I don't know where I had done mistake. Please help me in finding the problem.

Here is my code.

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

回答1:


Try this:

queryString = "update security set [password] = '" + MaskedTextBox2.Text + "' where [username] = '"+ TextBox1.Text +"' "


来源:https://stackoverflow.com/questions/24341476/error-code-0x80040e14-update-syntax-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!