944,087 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 6840
  • ASP RSS
Oct 28th, 2005
0

updating records using asp and mysql

Expand Post »
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+"'
Similar Threads
Reputation Points: 11
Solved Threads: 0
Junior Poster
aarya is offline Offline
139 posts
since Sep 2005
Oct 28th, 2005
0

Re: updating records using asp and mysql

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
Reputation Points: 11
Solved Threads: 0
Junior Poster
aarya is offline Offline
139 posts
since Sep 2005
Nov 6th, 2005
0

Re: updating records using asp and mysql

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..
Reputation Points: 10
Solved Threads: 0
Light Poster
ohgosh is offline Offline
41 posts
since Jul 2005
Nov 8th, 2005
0

Re: updating records using asp and mysql

yes i tried i mnot getting tany error but not updating
Reputation Points: 11
Solved Threads: 0
Junior Poster
aarya is offline Offline
139 posts
since Sep 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: syntax error: i cant find it..HELP!
Next Thread in ASP Forum Timeline: bu





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC