当前位置:编程学习 > 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调用Word打印的代码
下一个:asp下将数据库中的信息存储至XML文件中

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