當前位置:編程學習大全網 - 行動軟體 - ASP如何將ACCESS中的數據寫入數組中,如 ID 名字 成績 1 李四 100 2 張三 99

ASP如何將ACCESS中的數據寫入數組中,如 ID 名字 成績 1 李四 100 2 張三 99

<!--#include file="conn.asp"-->

<%

'調用數據庫連接函數

Call OpenDB(MainDB)

聲明數組

dim flshsz(5,2)

'sql查詢語句

DataCmd.CommandText = "Select top 5 * From chinammc_ads Where mmc_place='flash' And mmc_show=1 Order By mmc_id ASC"

定義記錄集對象設置對象名為RS

Set RS = DataCmd.Execute

x=0

do while not rs.eof

flshsz(x,0)=rs("mmc_name")

flshsz(x,1)=rs("mmc_pic")

flshsz(x,2)=rs("mmc_link")

x=x+1

RS.movenext

Loop

以上是循環語句把數據寫入數組flshsz中

Call CloseDB()

關閉數據庫連接

%>

<d type="2" title="<%=flshsz(0,0)%>" url="<%=flshsz(0,2)%>" bigImage="<%=flshsz(0,1)%>" smallImage="<%=flshsz(0,1)%>" venue="" showTime="" />

<d type="1" title="<%=flshsz(1,0)%>" url="<%=flshsz(1,2)%>" bigImage="<%=flshsz(1,1)%>" smallImage="<%=flshsz(1,1)%>" venue="<%=flshsz(1,0)%>" showTime="1" />

<d type="1" title="<%=flshsz(2,0)%>" url="<%=flshsz(2,2)%>" bigImage="<%=flshsz(2,1)%>" smallImage="<%=flshsz(2,1)%>" venue="<%=flshsz(2,0)%>" showTime="1" />

<d type="1" title="<%=flshsz(3,0)%>" url="<%=flshsz(3,2)%>" bigImage="<%=flshsz(3,1)%>" smallImage="<%=flshsz(3,1)%>" venue="<%=flshsz(3,0)%>" showTime="1" />

<d type="2" title="<%=flshsz(4,0)%>" url="<%=flshsz(4,2)%>" bigImage="<%=flshsz(4,1)%>" smallImage="<%=flshsz(4,1)%>" venue="<%=flshsz(4,0)%>" showTime="" />

以上的是對數組的調用

希望對妳有幫助

  • 上一篇:沛縣狗肉
  • 下一篇:求生物或者殺蟲方面專家鑒定這是什麽吸血蟲?非常感激
  • copyright 2024編程學習大全網