Error Code 0x80040E14 update syntax error

0

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
vb.net
ms-access-2007
asked on Stack Overflow Jun 21, 2014 by Sahil Manchanda • edited Jun 21, 2014 by marc_s

1 Answer

1

Try this:

queryString = "update security set [password] = '" + MaskedTextBox2.Text + "' where [username] = '"+ TextBox1.Text +"' "
answered on Stack Overflow Jul 28, 2016 by Malek Zyad • edited Jul 28, 2016 by Raktim Biswas

User contributions licensed under CC BY-SA 3.0