当前位置:编程学习 > asp >>

asp下如何在ADO服务器端利用好缓存技术?

答案:请看下面示例,这是一个用来显示图书分类的例子程序:

displayBooks.asp
< %@ LANGUAGE=JavaScript % >
< html >
< body >
< form method=post >
图书分类; < %= getBooksListBox() % >
< p>
< input type=submit >

< %
function getBooksListBox()
{
BooksListBox = Application("BooksListBox")
if (BooksListBox != null) return BooksListBox;
crlf = String.fromCharCode(13, 10)
BooksListBox = "< select name=Books>" + crlf;
SQL = "SELECT * FROM Books ORDER BY Name";
cnnBooks = Server.CreateObject("ADODB.Connection");
cnnBooks.Open("Books", "Admin","");
rstBooks = cnnBooks.Execute(SQL);
fldBookName = rstBooks("BookName");
while (!rstBooks.EOF){
BooksListBox = BooksListBox + " < option>" +
fldBookName + "" + crlf;
rstBooks.MoveNext();
}
BooksListBox = BooksListBox + ""
Application("BooksListBox") = BooksListBox

' 注意这句,Application技术的精华应哦
return BooksListBox;
}
% >

上一个:asp下DateDiff 函数参数说明
下一个:编写一个含二级目录的源码(Asp+JavaScript)

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,