asp下如何在ADO服务器端利用好缓存技术?
程序员文章站
2023-11-17 21:05:04
请看下面示例,这是一个用来显示图书分类的例子程序: displaybooks.asp < %@ language=javascript ...
请看下面示例,这是一个用来显示图书分类的例子程序:
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;
}
% >
上一篇: python使用sorted函数对列表进行排序的方法
下一篇: 把RS.GetRows看得更清楚