ASP怎樣循環(huán)讀取數(shù)據(jù)庫(kù)記錄-創(chuàng)新互聯(lián)

這篇文章給大家介紹ASP怎樣循環(huán)讀取數(shù)據(jù)庫(kù)記錄,內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對(duì)大家能有所幫助。

創(chuàng)新互聯(lián)建站專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、烏蘇網(wǎng)絡(luò)推廣、小程序制作、烏蘇網(wǎng)絡(luò)營(yíng)銷、烏蘇企業(yè)策劃、烏蘇品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營(yíng)等,從售前售中售后,我們都將竭誠(chéng)為您服務(wù),您的肯定,是我們大的嘉獎(jiǎng);創(chuàng)新互聯(lián)建站為所有大學(xué)生創(chuàng)業(yè)者提供烏蘇建站搭建服務(wù),24小時(shí)服務(wù)熱線:13518219792,官方網(wǎng)址:muchs.cn
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%Session.CodePage = 936%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" >
<meta  name="viewport" content="width=device-width, initial-scale=1.0, 
     minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" >
<title>Scale3DC2018Read</title>
</head>
<body>
<%
	Set conn= Server.CreateObject("ADODB.Connection") 
	connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=
	      "&Server.MapPath("\database\Scale3DCIP.mdb") 
	conn.Open connstr 
	
	Set rs = Server.CreateObject ("ADODB.Recordset") 
	sql = "Select * from custom order by id desc" 
	rs.Open sql,conn,1,1 
	
	do while not rs.eof  
%>
    <table border=1>
	<tr>
	<td><%=rs("keyid")%></td>
	<td><%=rs("IPAddress")%></td>
	<td><%=rs("Area")%></td>
	<td><%=rs("LoginTime")%></td>
	</tr>
	<%
	    rs.movenext
	 loop
	 
	 rs.close()
	 set rs = nothing
	 
	 conn.close()
	 set conn = nothing
	%>
	</table>
</body>

寫入數(shù)據(jù)庫(kù)


<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%Session.CodePage=936%> 
<!--#include file="web\\global.inc"-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" >
<!--meta http-equiv="Content-Type" content="text/html; charset=utf-8" /--> 
<meta  name="viewport" content="width=device-width, initial-scale=1.0,
     minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" >
<title>Scale3DC2018</title>
</head>
<body>
    <%
	     dim keyid
	     keyid = request.QueryString("keyid")
		 if IsEmpty(keyid) then
		    Response.End()
		 end if
	%>
	<%'創(chuàng)建連接對(duì)象
        set dbconnection=Server.CREATEOBJECT("ADODB.CONNECTION")
        DBPath =Server.MapPath("database/Scale3DCIP.mdb")
        dbconnection.Open  "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
	%>
	IP 地址
	<%
        dim ipStr	  
	        ipStr = getip()
      'Response.Redirect("http://api.map.baidu.com/location/ip?ip=
               "+getip()+"&ak=v6j7koi0ywtlK1RxZR47KSvkmmSzqIdn&coor=bd09ll")
	%>

	<%'創(chuàng)建記錄對(duì)象
         Set rs =Server.CreateObject("ADODB.Recordset")
		 '打開記錄表
		 dim stime
		 stime = Now()
		 rs.open "select * from Custom where IPAddress='"&ipStr&"'",dbconnection,1,3
		 if  rs.eof then
		    rs.close()
		    rs.Open "insert into Custom(KeyID,IPAddress,Area,loginTime)values 
		           ('"&keyid&"','"&ipStr&"','','"&stime&"')", dbconnection,1, 3
		 else
		    rs.close()
		    rs.Open "update Custom set loginTime ='"&stime&"' where KeyID =
		         '"&ipStr&"'", dbconnection,adOpenDynamic, 3
		 end if
	%>
	<%
	    'rs.close 無返回不需要此句
        set rs=nothing
        dbconnection.close
        set dbconnection=nothing
	%>
</body>

%后面最好不要加注釋,注釋加到其他行


關(guān)于ASP怎樣循環(huán)讀取數(shù)據(jù)庫(kù)記錄就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

名稱欄目:ASP怎樣循環(huán)讀取數(shù)據(jù)庫(kù)記錄-創(chuàng)新互聯(lián)
文章出自:http://muchs.cn/article30/deiopo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動(dòng)網(wǎng)站建設(shè)網(wǎng)頁設(shè)計(jì)公司、手機(jī)網(wǎng)站建設(shè)ChatGPT、全網(wǎng)營(yíng)銷推廣、App設(shè)計(jì)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

微信小程序開發(fā)