第四次上机,ASP组件的使用

时间:2023-03-09 22:54:55
第四次上机,ASP组件的使用

第四次上机,ASP组件的使用

 <html>
<body>
<%
'以下连接数据库,建立一个Connection对象实例conn
Set conn=Server.CreateObject("ADODB.Connection")
strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Info.mdb")
conn.Open strConn '以下利用Connection对象的Execute方法添加新记录
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
'sql="& strName & strPass"
'response.write sql 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")
Set MyPageCounter=Server.CreateObject("MSWC.pagecounter")
MyPageCounter.PageHit
response.Write"" & strName&",欢迎您的第"
response.write MyPageCounter.Hits
response.Write"次到来!" end if
conn.Close %>
</body>

相比于check2.asp,第30、31行添加了一个网页计数器,第33行添输出了计数器的值“response.write MyPageCounter.Hits”