如何使用ms access数据库设计ASP登录表单 [英] how to design ASP login form with ms access database

查看:99
本文介绍了如何使用ms access数据库设计ASP登录表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<%

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>

推荐答案

我有数据库连接问题,请帮助



尝试使用Server Explorer窗格在VS中设置连接:

1)打开服务器资源管理器。

2)右键单击数据连接并选择添加连接

3)在随后的对话框中,选择你的数据源和数据库,指定安全信息,然后按测试连接按钮。

4)连接工作时,按OK

5)突出显示您的数据库服务器资源管理器窗格,然后查看属性窗格。将显示连接字符串的工作示例,您可以将其复制并粘贴到您的应用程序或配置文件中。



如果这没有帮助,您需要更详细地解释错误。
"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.


这篇关于如何使用ms access数据库设计ASP登录表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆