第三次上机,ADO接口的使用

第三次上机,ADO接口的使用

第三次上机,ADO接口的使用

 <html>
<head>
<title>Reg</title>
</head>
<body><center>
<form method="post" action="RegServer.asp" name="RegServer">
<h2>请留下个人资料</h2>
<table border=0 width=501 >
<tr>
<td width="81" align="right">姓名: </td>
<td width="406" ><input type="text" name="name" size="15"></td>
</tr>
<tr>
<td width="81" align="right">密码: </td>
<td width="406" ><input type="text" name="password" size="15"></td>
</tr>
<tr>
<td width="81" align="right">性别: </td>
<td width="406" ><input type="radio" name="sex" value="男" cheaked>男&nbsp;&nbsp;<input type="radio" name="sex" value="女" cheaked>女&nbsp;&nbsp; </td>
</tr>
<tr>
<td width="81" align="right">学号: </td>
<td width="406" ><input type="text" name="xuehao" size="15"></td>
</tr>
<tr>
<td width="81" align="right">选择班级:</td>
<td width="406" ><select size="1" name="banji">
<%
for i = 1 to 6
Response.write" <option>机械160"&i&"</option>"
Next
%>
</select>班</td>
</tr>
<tr>
<td width="81" align="right">籍贯: </td>
<td width="406" ><input type="text" name="home" size="15"></td>
</tr>
<tr>
<td width="81" align="right">电话: </td>
<td width="406" ><input type="text" name="phonenumber" size="15"></td>
</tr>
<tr>
<td width="81" align="right">QQ: </td>
<td width="406" ><input type="text" name="qq" size="15"></td>
</tr>
<tr>
<td width="81" align="right">E-mail: </td>
<td width="406" ><input type="text" name="email" size="15"></td>
</tr>
<tr>
<td width="81" align="right">备注: </td>
<td width="406" ><textarea rows=4 name=beizhu cols=38></textarea></td>
</tr>
</table>
<p><input type="submit" value="提交" name="B1">
<input type="reset" value="全部重写" name="B2"></p>
</form>
</body>
</html>
 <!-- File name:RegSever.asp -->
<html>
<body>
<%
Dim strName,strPass,strSex,strNum,strTele,strClass,strQQ,strEmail,strNativePlace,strRemark,dtmSubmit
strName = Request.Form("name")
strPass = Request.Form("password")
strNum = Request.Form("xuehao")
strNativePlasce = Request.Form("home")
strTele = Request.Form("phonenumber")
strQQ = Request.Form("qq")
strEmail = Request.Form("email")
strRemark = Request.Form("beizhu")
strSex = Request.Form("sex")
strClass = Request.Form("banji")
dtmSubmit=Date()
Set conn=Server.CreateObject("ADODB.Connection")
strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Info.mdb")
conn.Open strConn
conn.Execute("Insert Into tbInfo(strName,strPass,strSex,strNum,strTele,strClass,strQQ,strEmail,strNativePlace,strRemark,dtmSubmit) Values('"& strName &"','"& strPass &"','"&strSex &"','"& strNum &"','"& strTele &"','"& strClass &"','"& strQQ &"','"& strEmail &"','"& strTele &"','"& strRemark &"', #"&dtmSubmit&"#)")
conn.Close
%>
</body>
</html>

运行结果如下:

第三次上机,ADO接口的使用

第三次上机,ADO接口的使用

 <html>
<body>
<%
Set conn=Server.CreateObject("ADODB.Connection")
strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Info.mdb")
conn.Open strConn
Dim strName,strPass
strName = Request.Form("T1")
strPass = Request.Form("T2")
strName="'" & strName & "'"
strPass="'" & strPass & "'" sql="select * from tbInfo where strName=" & strName & "and strPass=" & strPass
Set rs=conn.Execute(sql)
if rs.BOF=true and rs.EOF=true then
response.Write "登录名或密码错误!"
%>
<a href="./Login.html">返回登录界面</a>
<%
else
strName = Request.Form("T1")
response.Write"" & strName&",欢迎您的到来!"
end if
conn.Close %>
</body>

运行结果如下:

登陆成功

第三次上机,ADO接口的使用

登录失败

第三次上机,ADO接口的使用

(之前已注册姓名为“”“小明”的用户,密码设置为“123”)

上一篇:sed的用法


下一篇:【转】理解WebKit和Chromium: JavaScript引擎简介