Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 What's wrong w/ this SQL statement?

Author  Topic 

o2bnlv
Starting Member

5 Posts

Posted - 2012-06-13 : 16:13:52
UPDATE USERLIST2 set PASSWORD = 'newpassword' WHERE LEVEL2ID = 'sample'

The table and field names are correct...

Thanks!

Gabriel

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-06-13 : 16:16:39
There's nothing wrong with the syntax. Are you getting an error?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-06-13 : 16:28:22
is that a quiz question?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

o2bnlv
Starting Member

5 Posts

Posted - 2012-06-13 : 16:47:22
Error:

Syntax error in UPDATE statement.

Here's the full code:


<%
newpass = Request.Form("txtPassword")
set conn = server.CreateObject ("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath ("users.mdb")
set rs = server.CreateObject ("ADODB.Recordset")
'rs.open "SELECT * FROM USERLIST2 ", conn, 3,3
dim strsql
strsql = "UPDATE USERLIST2 set PASSWORD = '" & newpass & "' WHERE LEVEL2ID = '" & session("level2id") & "'"
'Response.Write(strsql)
conn.Execute strsql
'Response.Redirect("changepass.asp")
%>
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2012-06-13 : 16:59:43
What does response.write(strsql) return?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

o2bnlv
Starting Member

5 Posts

Posted - 2012-06-13 : 17:08:10
The string in the first post:

UPDATE USERLIST2 set PASSWORD = 'newpassword' WHERE LEVEL2ID = 'sample'
Go to Top of Page

bitsmed
Aged Yak Warrior

545 Posts

Posted - 2012-06-13 : 17:13:07
Try this:

update userlist2
set [password]='newpassword'
where [level2id]='sample'

Go to Top of Page

o2bnlv
Starting Member

5 Posts

Posted - 2012-06-13 : 17:40:44
That fixed it, thanks for your help!
Go to Top of Page
   

- Advertisement -