您的位置:首页 > 编程语言 > ASP

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

2020-03-01 23:43 603 查看

 

1 <html>
2 <body>
3     <%
4         '以下连接数据库,建立一个Connection对象实例conn
5        Set conn=Server.CreateObject("ADODB.Connection")
6        strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Info.mdb")
7        conn.Open strConn
8
9           '以下利用Connection对象的Execute方法添加新记录
10         Dim strName,strPass
11          strName = Request.Form("T1")
12          strPass = Request.Form("T2")
13         strName="'" & strName & "'"
14         strPass="'" & strPass & "'"
15
16         sql="select * from tbInfo where strName=" & strName & "and strPass=" & strPass
17         'sql="& strName & strPass"
18         'response.write sql
19
20
21          Set rs=conn.Execute(sql)
22
23         if rs.BOF=true and rs.EOF=true then
24          response.Write "登录名或密码错误!"
25 %>
26 <a href="./Login.html">返回登录界面</a>
27 <%
28          else
29               strName = Request.Form("T1")
30              Set MyPageCounter=Server.CreateObject("MSWC.pagecounter")
31              MyPageCounter.PageHit
32                 response.Write"" & strName&",欢迎您的第"
33                 response.write MyPageCounter.Hits
34                 response.Write"次到来!"
35
36          end if
37         conn.Close
38
39     %>
40 </body>

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

转载于:https://www.cnblogs.com/chenyuyang06/p/10653621.html

  • 点赞
  • 收藏
  • 分享
  • 文章举报
aql34635 发布了0 篇原创文章 · 获赞 0 · 访问量 86 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: