944,214 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 2923
  • ASP RSS
Oct 26th, 2005
0

register error

Expand Post »
i m trying to use mysql database with asp,i m trying to code regsiter.asp. but i m getting the error
this is my code
<%dim struser,strpass,stremail,strlname,strfname,straddress,straddress1,straddress2,strcity,strcountry,strsql
stremail=request.from("email")
strfname=request.form("fname")
strlname=request.form("lname")
straddress=request.form("address")
straddress1=request.form("address1")
straddress2=request.from("address2")
strcity=request.form("city")
strcountry=request.from("country")
struser=request.form("usercode")
strpass=request.form("pass")

response.write(user)
response.write(pass)
' Open database
Dim Conn, RS
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={MySql ODBC 3.51 Driver}; Server=localhost; database=slogin; uid=user; pwd=pass;

option=3;"
strsql ="insert into users1 (usercode,fname,lname,address,address1,address2,city,country,password)
values("'+ struser +'","'+stremail +'","'+ strfname +'","'+ strlname +'","'+ straddress +'","'+ straddress1 +'","'+

straddress2 +'","'+ strcity +'","'+ strcountry +'","'+ strpass +'")"

%>

the error is
Error Type:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/myweb/addusr.asp, line 19, column 98
strsql ="insert into users1 (usercode,fname,lname,address,address1,address2,city,country,password)

help me in solving the problem
Similar Threads
Reputation Points: 11
Solved Threads: 0
Junior Poster
aarya is offline Offline
139 posts
since Sep 2005
Oct 26th, 2005
0

Re: register error

it looks like the line you have an error on is missing the end quote

Conn.Open "Driver={MySql ODBC 3.51 Driver}; Server=localhost; database=slogin; uid=user; pwd=pass;"

Or try re-writing it

Conn.ConnectionString = "Provider={MySql ODBC 3.51 Driver};" & _
"Data Source=localhost ;" & _
"Initial Catalog= slogin;" & _
"User Id= user ;" & _
"Password= pass "

Conn.Open
Reputation Points: 8
Solved Threads: 6
Posting Whiz in Training
extofer is offline Offline
239 posts
since Aug 2005
Oct 27th, 2005
0

Re: register error

i have tried but i m getting the error as untermineted string constant on line where
this code is there

strsql="insert into users1 (usercode,fname,lname,address,address1,address2,city,country,password)
values("'+ struser +'","'+stremail +'","'+ strfname +'","'+ strlname +'","'+ straddress +'","'+ straddress1 +'","'+

straddress2 +'","'+ strcity +'","'+ strcountry +'","'+ strpass +'")"
set RS=Conn.execute(strsql)

if i use value it is working i means the values are instertaing into the database.
strsql = "INSERT INTO users1 VALUES(0, 'Ji', 'Sm, '20 SParade', 'Beverly Hills', '555 0303','rej','dsa','ds','dsa','yt','g')"
this is working
but i m not able to trace this code. is this wrong approach to insert into that database.?
values("'+ struser +'","'+stremail +'","'+ strfname +'","'+ strlname +'","'+ straddress +'","'+ straddress1 +'","'+

straddress2 +'","'+ strcity +'","'+ strcountry +'","'+ strpass +'")"
Reputation Points: 11
Solved Threads: 0
Junior Poster
aarya is offline Offline
139 posts
since Sep 2005
Oct 27th, 2005
0

Re: register error

Looks like this is you problem

strsql="insert into users1 (usercode,fname,lname,address,address1,address2,city,country,password)
values("'+ struser +'","'+stremail +'","'+ strfname +'","'+ strlname +'","'+ straddress +'","'+ straddress1 +'","'+


you have one extra value trying to insert... stremail. you either add it to the fields or remove it from trying to insert
Reputation Points: 8
Solved Threads: 6
Posting Whiz in Training
extofer is offline Offline
239 posts
since Aug 2005
Oct 27th, 2005
0

Re: register error

this problem is solved the code is now
<%
dim struser,strpass,stremail,strlname,strfname,straddress,straddress1,straddress2,strcity,strsql,strcountry,strreg
stremail=request.form("email")
strfname=request.form("fname")
strlname=request.form("lname")
straddress=request.form("address")
straddress1=request.form("address2")
straddress2=request.form("address3")
strcity=request.form("city")
strcountry=request.form("country")
struser=request.form("usercode")
strpass=request.form("pass")
strreg=date()
response.write strreg
Dim Conn, RS
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={MySql ODBC 3.51 Driver}; Server=localhost; database=slogin; uid=nagaraja sastry; pwd=g86iyug;

option=3;"
strSQL = "INSERT INTO users1 VALUES

('"+struser+"','"+stremail+"','"+strfname+"','"+strlname+"','"+strfaddress+"','"+straddress1+"'

,'"+straddress2+"','"+strcity+"','"+strcountry+"','"+strpass+"')"



set RS=Conn.execute(strsql)

%>
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: login check
Next Thread in ASP Forum Timeline: Losing session variable problem...help!





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


Follow us on Twitter


© 2011 DaniWeb® LLC