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

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

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 +'")"

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

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)

%>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.