register error

Reply

Join Date: Sep 2005
Posts: 139
Reputation: aarya is an unknown quantity at this point 
Solved Threads: 0
aarya's Avatar
aarya aarya is offline Offline
Junior Poster

register error

 
0
  #1
Oct 26th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 239
Reputation: extofer is an unknown quantity at this point 
Solved Threads: 5
extofer's Avatar
extofer extofer is offline Offline
Posting Whiz in Training

Re: register error

 
0
  #2
Oct 26th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 139
Reputation: aarya is an unknown quantity at this point 
Solved Threads: 0
aarya's Avatar
aarya aarya is offline Offline
Junior Poster

Re: register error

 
0
  #3
Oct 27th, 2005
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 +'")"
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 239
Reputation: extofer is an unknown quantity at this point 
Solved Threads: 5
extofer's Avatar
extofer extofer is offline Offline
Posting Whiz in Training

Re: register error

 
0
  #4
Oct 27th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 139
Reputation: aarya is an unknown quantity at this point 
Solved Threads: 0
aarya's Avatar
aarya aarya is offline Offline
Junior Poster

Re: register error

 
0
  #5
Oct 27th, 2005
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)

%>
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC