请看下面示例,这是一个用来显示图书分类的例子程序:
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;
}
% >
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“asp下如何在ADO服务器端利用好缓存技术?”评论...