asp下如何在ADO服务器端利用好缓存技术?
(编辑:jimmy 日期: 2024/11/27 浏览:3 次 )
请看下面示例,这是一个用来显示图书分类的例子程序:
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;
}
% >
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下如何在Access数据库中立即得到所插入记录的自动编号?