•
•
•
•
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
![]() |
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
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
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
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
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 +'")"
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 +'")"
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
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
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)
%>
<%
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)
%>
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb ASP Marketplace
- Installscript and ISScript.msi (Windows NT / 2000 / XP / 2003)
- No desktop (Windows NT / 2000 / XP / 2003)
- sql data pull with no result gives Object reference not set exception (VB.NET)
- the geforce blues (Windows NT / 2000 / XP / 2003)
Other Threads in the ASP Forum
- Previous Thread: login check
- Next Thread: Losing session variable problem...help!


Linear Mode