954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

updating records using asp and mysql

i m getting the error as
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/myweb/updat.asp, line 18, column 181
my code is

<% if session("bvuser")="true" then
struser=request("usercode")
stremail=request("email")
strfname=request("fname")
strlname=request("lname")
straddress=request("address")
straddress1=request("address2")
straddress2=request("address3")
strcity=request("city")
strcountry=request("country")
strpassword=request("password")
struser=session("usercode")
dim rsupdat,Conn,sql
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={MySql ODBC 3.51 Driver}; Server=localhost; database=slogin; uid=user; pwd=pass;

option=3;"

set rsupdat=server.createobject("ADODB.connection")
sql="update users1 set email='"+stremail+"' and fname='"+strfname+"' and lname='"+strlname+"' and

address='"+straddress+"' and address1='"+straddress1+"' and address2='"+straddress2"' and city='"+strcity+"' and

country='"+strcountry+"' and password='"+strpassword+"' where usercode='"+struser+"';"

set rsupdat=Conn.execute(sql)
response.write("updat")
else
response.write ("login")
end if
%>

i m trying to upadat the database using mysql. i m learning asp. pls anybody figure out the mistake i have done.i tried so much but i could not figure it out
error is showing on

sql=update users1 set email='"+stremail+"' and fname='"+strfname+"' and lname='"+strlname+"' and

address='"+straddress+"' and address1='"+straddress1+"' and address2='"+straddress2"' and city='"+strcity+"' and

country='"+strcountry+"' and password='"+strpassword+"' where usercode='"+struser+"'

aarya
Junior Poster
139 posts since Sep 2005
Reputation Points: 11
Solved Threads: 0
 

i could remove the error by relacing this code
sql="update users1 set email='+stremail+' and fname='+strfname+' and lname='+strlname+' and address='+straddress+'

and address1='+straddress1+' and address2='+straddress2' and city='+strcity+' and country='+strcountry+' and

password='+strpassword+' where usercode='+struser+';"

but it is not upadating in my database

aarya
Junior Poster
139 posts since Sep 2005
Reputation Points: 11
Solved Threads: 0
 

was it bcos of ur concatenation?

sql="update users1 set email='" & stremail & "' and fname='" & strfname & "' and lname='" & strlname & "' and address='" & straddress & "' and address1='" & straddress1 & "' and address2='" & straddress2 & "' and city='" & strcity & "' and
country='" & strcountry & "' and password='"+ & strpassword & "' where usercode='" & struser & ";"

and please check ur syntax for this part..
";" not "';"

and
and address2='"+straddress2"' and, u lack of a concatenation

let us know if my points are useful okie? should hear from u soon..

ohgosh
Light Poster
41 posts since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

yes i tried i mnot getting tany error but not updating

aarya
Junior Poster
139 posts since Sep 2005
Reputation Points: 11
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You