首页 > Web开发 > 详细

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

时间:2019-04-04 11:09:52      阅读:103      评论:0      收藏:0      [点我收藏+]

技术分享图片

 

 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”

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

原文:https://www.cnblogs.com/chenyuyang06/p/10653621.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!