SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 What's wrong w/ this SQL statement?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

o2bnlv
Starting Member

5 Posts

Posted - 06/13/2012 :  16:13:52  Show Profile  Reply with Quote
UPDATE USERLIST2 set PASSWORD = 'newpassword' WHERE LEVEL2ID = 'sample'

The table and field names are correct...

Thanks!

Gabriel

robvolk
Most Valuable Yak

USA
15568 Posts

Posted - 06/13/2012 :  16:16:39  Show Profile  Visit robvolk's Homepage  Reply with Quote
There's nothing wrong with the syntax. Are you getting an error?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
48076 Posts

Posted - 06/13/2012 :  16:28:22  Show Profile  Reply with Quote
is that a quiz question?

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

Go to Top of Page

o2bnlv
Starting Member

5 Posts

Posted - 06/13/2012 :  16:47:22  Show Profile  Reply with Quote
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

Sweden
29156 Posts

Posted - 06/13/2012 :  16:59:43  Show Profile  Visit SwePeso's Homepage  Reply with Quote
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 - 06/13/2012 :  17:08:10  Show Profile  Reply with Quote
The string in the first post:

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

bitsmed
Posting Yak Master

Denmark
107 Posts

Posted - 06/13/2012 :  17:13:07  Show Profile  Reply with Quote
Try this:

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

Go to Top of Page

o2bnlv
Starting Member

5 Posts

Posted - 06/13/2012 :  17:40:44  Show Profile  Reply with Quote
That fixed it, thanks for your help!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000