| | |
syntax error in update statement
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Jun 2009
Posts: 143
Reputation:
Solved Threads: 14
this is my code
VB.NET Syntax (Toggle Plain Text)
If Me.txtOldPassword.Text = pwd Then Dim oledbcom1 As New OleDb.OleDbCommand oledbcom1.CommandText = "Update login Set password = ?" oledbcom1.Connection = oledbcon oledbcom1.Parameters.Add("?", OleDb.OleDbType.VarChar) oledbcom1.Parameters(0).Value = Me.txtNewPassword.Text.Trim oledbcom1.ExecuteNonQuery() oledbcon.Close() end if
•
•
Join Date: Sep 2009
Posts: 321
Reputation:
Solved Threads: 45
Sknake is right, you need to provide the error message for anyone to provide detailed help other then guessing at whatelse might be going on in your code. For instance, I do not see where you are opening the database connection although you may be doing that elsewhere in the program.
Also is this a single user program, meaning there can be only one person with an account and login? I dont see a where clause in your update query string meaning if there is more then one account, it will update every record in that table.
Also is this a single user program, meaning there can be only one person with an account and login? I dont see a where clause in your update query string meaning if there is more then one account, it will update every record in that table.
•
•
•
•
this is my code
VB.NET Syntax (Toggle Plain Text)
If Me.txtOldPassword.Text = pwd Then Dim oledbcom1 As New OleDb.OleDbCommand oledbcom1.CommandText = "Update login Set password = ?" oledbcom1.Connection = oledbcon oledbcom1.Parameters.Add("?", OleDb.OleDbType.VarChar) oledbcom1.Parameters(0).Value = Me.txtNewPassword.Text.Trim oledbcom1.ExecuteNonQuery() oledbcon.Close() end if
I am going to suggest you name the params.
Ex:
VB.NET Syntax (Toggle Plain Text)
oledbcom1.CommandText = "Update login Set password = @Password" oledbcom1.Parameters.Add("@Password", OleDb.OleDbType.VarChar).Value = Me.txtNewPassword.Text.Trim
Hope this Helps...
Field name password is a access's reserved word.
Use,
Use,
VB.NET Syntax (Toggle Plain Text)
str="update login set [password]=?"
Last edited by adatapost; Sep 24th, 2009 at 3:09 am.
•
•
Join Date: Jun 2009
Posts: 143
Reputation:
Solved Threads: 14
•
•
•
•
Field name password is a access's reserved word.
Use,
VB.NET Syntax (Toggle Plain Text)
str="update login set [password]=?"
Welcome TomW,
Read this - SQL Reserved Words
http://sqlserver2000.databases.aspfa...-keywords.html
Read this - SQL Reserved Words
•
•
•
•
SUMMARY:
The following list includes all words reserved by the Microsoft Jet database engine for use in SQL statements . The words in the list that are not in all uppercase letters are also reserved by other applications. Consequently, the individual Help topics for these words provide general descriptions that do not focus on SQL usage.
![]() |
Similar Threads
- Error when update database with vb.net (MS Access and FileMaker Pro)
- Error in writing statement for UPDATE and DELETE (VB.NET)
- Syntax error in UPDATE statement. (VB.NET)
- Syntax error on update database code (VB.NET)
- syntax Error.. (VB.NET)
- Syntax error in INSERT INTO statement, please help (ASP)
- Syntax error in INSERT INTO statement (Java)
- Problems on Insert and Update Statement (C#)
Other Threads in the VB.NET Forum
- Previous Thread: Help for VS.NET/SQL
- Next Thread: Invalid Operation exception..plz help
Views: 820 | Replies: 12
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access account application arithmetic array arrays basic bing button buttons c# center check checkbox code convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog filter ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor net networking objects output panel passingparameters picturebox picturebox1 port position print printing problem project read remove save searchbox searchvb.net select serial shutdown soap sorting survey syntax table tcp temperature text textbox timer timespan toolbox trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio2008 web webbrowser winforms wpf year






) and good luck! 