User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 392,068 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,282 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 2074 | Replies: 4
Reply
Join Date: Sep 2005
Posts: 139
Reputation: aarya is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
aarya's Avatar
aarya aarya is offline Offline
Junior Poster

register error

  #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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: El Paso, TX
Posts: 225
Reputation: extofer is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 5
extofer's Avatar
extofer extofer is offline Offline
Posting Whiz in Training

Re: register error

  #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  
Join Date: Sep 2005
Posts: 139
Reputation: aarya is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
aarya's Avatar
aarya aarya is offline Offline
Junior Poster

Re: register error

  #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  
Join Date: Aug 2005
Location: El Paso, TX
Posts: 225
Reputation: extofer is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 5
extofer's Avatar
extofer extofer is offline Offline
Posting Whiz in Training

Re: register error

  #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  
Join Date: Sep 2005
Posts: 139
Reputation: aarya is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
aarya's Avatar
aarya aarya is offline Offline
Junior Poster

Re: register error

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP Forum

All times are GMT -4. The time now is 11:52 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC