Solved

Updating a table using SQL

Posted on 2000-03-23
3
122 Views
Last Modified: 2010-05-02
I'm trying to update a table using the following code and keep getting an error 3144 syntax error in the update statement.  If I take the where clause out it updates all the passwords in the table.


 
SQL = "UPDATE SECURITYABS SET " _
    & "PASSWORD = '" & UCase(txtNewPW.Text) & "', " _
    & "WHERE USERNAME = '" & UCase(txtUserName.Text) & "'"

Any help would be appreciated.

Thanks.




0
Comment
Question by:TOMMYC
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
samopal earned 50 total points
Comment Utility
SQL = "UPDATE SECURITYABS SET " _
    & "PASSWORD = '" & UCase(txtNewPW.Text) & _
    & "' WHERE USERNAME = '" & UCase(txtUserName.Text) & "'"


HTH
0
 
LVL 1

Expert Comment

by:tkuppinen
Comment Utility
Take the the comma out

SQL = "UPDATE SECURITYABS SET " _
    & "PASSWORD = '" & UCase(txtNewPW.Text) & "'" & _
    & " WHERE USERNAME = '" & UCase(txtUserName.Text) & "'"

0
 
LVL 1

Expert Comment

by:tkuppinen
Comment Utility
You may also want to look at using the replace function anytime you are inserting text into your db.  If there is a single quote in this string it will mess everything up.

pseudocode

Replace(textusername.text, " ' " , " '' ")

Of course you would have to take the spaces out, I just put them in to try to illustrate it more clearly.

0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now