Click here to Skip to main content
15,886,693 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<%

uname=trim(request.form("uname"))
pass1=trim(request.form("pass1"))
fname=trim(request.form("fname"))
lname=trim(request.form("lname"))
mail=trim(request.form("mail"))
phone=trim(request.form("phone"))
cell=trim(request.form("cell"))

Set con = Server.CreateObject("ADODB.Connection")
strcon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db1.mdb")
Con.open strcon

u=1
if len(uname)=0 or len(pass1)=0 or len(fname)=0 then
 Response.redirect "registration.html"
 u=0
end if
if len(lname)=0 or len(mail)=0 or len(phone)=0 then
 Response.redirect "registration.html"
 u=0
 end if
 if len(cell)=0 then
 cell="None"
 end if

if u > 0 then
v=0
Set rsCheckUser = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT usersid.uname FROM usersid"
rsCheckUser.Open strSQL, strCon
while not rsCheckUser.EOF
    If (uname = rsCheckUser("uname")) Then
    v=1
    end if
    rscheckuser.MoveNext
wend

if (v>0) then

    Response.Redirect ("err1.asp")
else
    mysql= "insert into uinfo(uname,fname,lname,email,phone,cell) values ('"&uname&"','"&fname&"','"&lname&"','"&mail&"','"&phone&"','"&cell&"')"
    con.execute mysql
    mysql="insert into usersid(uname,upass) values ('"&uname&"','"&pass1&"')"
    con.execute mysql
    response.write "<center><font size=+2 color='blue'>Thank you for Registering!</font></center>"
end if

end if
%>
<html>
<body>
<a href="login.html">Click Here</a> go to log in.
</body>
</html>
Posted
Comments
Member 11281895 21-Mar-15 11:19am    
i have problem with database connection,please help

1 solution

"i have problem with database connection,please help"

Try setting up a connection in VS with the Server Explorer pane:
1) Open Server Explorer.
2) Right click "Data connections" and select "Add connection"
3) In the dialog that follows, select your DataSource, and database, specify the security info, and press the "Test connection" button.
4) When the connection works, press "OK"
5) Highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your app or config file.

If that doesn't help, you need to explain the error in a lot more detail.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900