⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addrecord.asp

📁 ASP+SQL Server动态网站开发从基础到实践教程
💻 ASP
字号:
<html>

<head>

<title>注册处理页面</title>
</head>

<body>
<%
Dim ConnStr,myConn,mySQL
dim myID,myName,myPass,myBirth,myDip,myTel,myCell,myIDCard
dim myPro,myCity,myGender,myQues,myAns,myHomePage,myAdd,myPost
ConnStr="Provider=microsoft.jet.oledb.4.0;data source=" & server.mappath("../accessDB/masterasp.mdb") 
Set myConn=Server.CreateObject ("ADODB.Connection")
Myconn. ConnectionString=ConnStr
myConn.open  '直接打开数据库连接



myID=request.form("login")  '用户名
myName=request.form("realname")  '真实姓名
myPass=request.form("passwd")  '密码
myBirth=request.form("birth")  '生日
myDip=request.form("diploma")    '学历
myTel=request.form("telphone")  '电话
myCell=request.form("cellphone")  '手机
myIDCard=request.form("idCard")   '身份证
myPro=request.form("state")   '省份
myCity=request.form("city")  '城市 
myGender=request.form("gender")  '性别
myQues=request.form("question")   '提示问题
myAns=request.form("answer")   '提示答案
myHomePage=request.form("homepage")   '主页
myAdd=request.form("address")  '地址
myPost=request.form("postcode")  '邮政编码

'查询该ID是否存在
mySQL="select * from register where UserID='" & myID & "'"
set myRes=myConn.execute(mySQL) 

if myRes.bof and myRes.eof then

'定义一个Insert的SQL语句,向maserasp.mdb的register数据库表插入一条记录
mySQL="insert into register (UserID,UserPWD,UserName,Birth,Diploma,TelPhone,CellPhone,"
mySQL=mySQL+"IDCard,Province,City,Gender,PassQuestion,PassAnswer,HomePage,Address,PostCode)"
mySQL=mySQL+" values ('" & myID & "','" & myPass &  "','" & myName &  "',#" 
mySQL=mySQL + myBirth &  "#,'" & myDip &  "','" & myTel & "','" &  myCell 
mySQL=mySQL + "','" & myIDCard &  "','" & myPro &  "','" & myCity &  "','" & myGender
mySQL=mySQL + "','" & myQues &  "','" & myAns &  "','" & myHomePage &  "','" & myAdd
mySQL=mySQL +  "','" & myPost & "')"

myConn.Execute mySQL

response.write "<br>你注册成功,请回到登录页面!"
%>
<a href="../chap10/access/login.asp">单击这里链接到登录页面 </a>

<%
else

response.write "该帐号已经存在!"

%>
<!-- #include file="register.asp" -->
<%
end if 

myConn.close
set myConn=nothing

%>



</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -