怎么在服務(wù)器上保存一定時(shí)間的信息
發(fā)表時(shí)間:2023-08-10 來(lái)源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]http://www.asp888.net 豆腐技術(shù)站 <%@import namespace="system.data.SQL"%><%@OutputCach...
http://www.asp888.net 豆腐技術(shù)站
<%@import namespace="system.data.SQL"%>
<%@OutputCache Duration = "3600"%>
/*
這個(gè) OutputCache 的前綴的意思是 這個(gè)頁(yè)面
在 server 被保持的 時(shí)間的長(zhǎng)度 單位是 秒
我現(xiàn)在把這個(gè)程序的 保持時(shí)間 設(shè)置成為 3600 也就是一個(gè)小時(shí)
這樣,即使你對(duì) 數(shù)據(jù)庫(kù) 的 數(shù)據(jù)進(jìn)行 任何的 改變 程序都不會(huì)去理睬
仍然顯示的是 你的 沒(méi)有修改的以前的 數(shù)據(jù)
*/
<SCRIPT LANGUAGE="vb" RUNAT="server">
Sub Page_Load(myList AS Object,E as EventArgs)
Dim dbRead AS SQLDataReader
Dim dbComm AS SQLCommand
Dim SQLserver AS String
Dim SQL AS String
conn = "server=localhost;uid=sa;password=;database=doufu"
'這個(gè)是另外一種 連接 數(shù)據(jù)庫(kù) 的方法,我們不需要去 創(chuàng)建一個(gè) SQLConnection
’性質(zhì) 其實(shí)是 一樣的
SQL = "Select * from msgboard"
dbComm = New SQLCommand(SQL,conn)
dbComm.ActiveConnection.Open()
dbComm.execute(dbRead)
While dbRead.Read()
'這里簡(jiǎn)單的介紹了 asp+ 中對(duì) dropdownlist 的簡(jiǎn)單操作辦法
test.items.add(New ListItem(dbRead.Item("msgTitle")))
End While
End Sub
</SCRIPT>
<FORM RUNAT="server" method="get">
<asp:DropDownList id="test" runat="server"/>
</FORM>