Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Updating a table using SQL

Posted on 2000-03-23
3
Medium Priority
?
131 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 200 total points
ID: 2650114
SQL = "UPDATE SECURITYABS SET " _
    & "PASSWORD = '" & UCase(txtNewPW.Text) & _
    & "' WHERE USERNAME = '" & UCase(txtUserName.Text) & "'"


HTH
0
 
LVL 1

Expert Comment

by:tkuppinen
ID: 2650117
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
ID: 2650132
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

963 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