请帮我的ASP文件添加SQL查询语句,谢谢!

来源:百度知道 编辑:UC知道 时间:2024/05/27 13:10:58
<%
action=request("action")
username=request("username")
password=request("password")
newpassword=request("newpassword")
if request("ip") ="" then
ip=Request.ServerVariables("REMOTE_ADDR")
end if
/////////////////////////////////////////////
function 账号是否存在
匹配数据库检查账号是否存在,存在则返回真,这个我不会写,麻烦大家帮我写下....
/////////////////////////////////////////////
if action="reg" then
if username="" or password="" or mail="" then
response.write "注册失败,账号密码邮箱不能为空"
response.end
end if
if 账号是否存在(username) then
response.write "注册失败,账号已经存在"
response.end
end if
/////////////////////////////////////////////
在这里执行SQL语句,添加新的项目,将 username 和 password 和 mail添加进去
/////////////////////////////////////////////
response.write("注册成功")
response.end
end

这是调试通过的
<%
'这里假定你的数据库名为db.mdb放在Datebase目录下,用户表名为users,其中有id(自动编号),userName,PassWord,ip,email几个字段
dim conn,connstr,strdb,rs,action,username,password,newpassword,ip,mail
strdb="Datebase/db.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath(""&strdb&"")
conn.Open connstr

action=request("action")
username=request("username")
password=request("password")
newpassword=request("newpassword")
mail=request("mail")
if request("ip") ="" then
ip=Request.ServerVariables("REMOTE_ADDR")
end if

if action="reg" then
if username="" or password="" or mail="" then
response.write("注册失败,账号密码邮箱不能为空")
response.end
end if
if