Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
01-15-2012, 02:45 PM #1
- Join Date
- Jan 2012
- Thanked 0 Times in 0 Posts
Syntax error in UPDATE statement.
I have this error when I run this code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ConnString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Passwords.accdb"
Dim SqlString As String = "Update [Pass] Set UserName = ?, Password = ?"
Using conn As New OleDb.OleDbConnection(ConnString)
Using cmd As New OleDb.OleDbCommand(SqlString, conn)
cmd.CommandType = CommandType.Text
I am a newbbie in xthis field so I will provide you details of the access database:
Database name: Passwords.accdb
Table name: Pass : Table
Fields in the table name: UserName and Password
I also uploaded a printscreen with my form
Any suggestions are very welcomed......
01-19-2012, 12:16 PM #2
- Join Date
- Jul 2011
- Chennai, India
- Thanked 5 Times in 5 Posts
You didn't given the error which thrown during execution.
Try this, instead of using parameters, supply the values directly in the query and execute.
Dim SqlString As String = "Update [Pass] Set UserName = '"+TextBox1.Text+"', Password = '" + TextBox2.Text + '"
Make sure that the both text boxes are not null.