【正文】
hen currentpage=1 end if if (currentpage1)*MaxPerPagetotalput then if (totalPut mod MaxPerPage)=0 then currentpage= totalPut \ MaxPerPage else currentpage= totalPut \ MaxPerPage + 1 end if end if if currentPage=1 then showpages showContent showpages else if (currentPage1)*MaxPerPagetotalPut then (currentPage1)*MaxPerPage dim bookmark bookmark= showpages showContent showpages else currentPage=1 showpages showContent showpages end if end if end if set rs=nothing set conn=nothing sub showContent dim i i=0 % table border=1 cellspacing=0 width=90% bgcolor=F0F8FF bordercolorlight=000000 bordercolordark=FFFFFF align=center tr td width=12% align=centerstrongID 號(hào) /strong/td td width=13% align=centerb類 型 /b/td td width=47% align=centerstrong 信 息 名 稱/strong/td td width=14% align=centerstrong修 改 /strong/td td width=14% align=centerstrong刪 除 /strong/td /tr %do while not % tr td width=12% height=7 p align=center%=rs(articleid)% /td td width=13% height=7 div align=center%=rs(type)%/div /td td width=47% height=7a href=?id=%=rs(articleid)%%=rs(title)%/a/td td width=14% align=center height=7a href=?id=%=rs(articleid)%修 改 /a/td td width=14% align=center height=7a href=?id=%=rs(articleid)%刪 除 /a/td /tr % i=i+1 if i=MaxPerPage then exit do loop % /table p% end sub sub showpages() dim n if (totalPut mod MaxPerPage)=0 then n= totalPut \ MaxPerPage else n= totalPut \ MaxPerPage + 1 end if if n=1 then p align=39。 charset=gb2312 title管理文件 /title meta name=GENERATOR content=Microsoft FrontPage link rel=stylesheet href=css/ /head % const MaxPerPage=20 dim totalPut dim CurrentPage dim TotalPages dim i,j if not isempty(request(page)) then currentPage=cint(request(page)) else currentPage=1 end if % body bgcolor=FFFFFF p /p table width=700 border=1 cellspacing=0 cellpadding=0 align=center bordercolorlight=000000 bordercolordark=FFFFFF tr bgcolor=99CCFF td height=10 bgcolor=3399cc div align=centerb管 理 界 面 /b/div /td /tr tr td height=49% dim sql dim rs sql=select * from learning order by articleid desc Set rs= () sql,conn,1,1 if and then p align=39。 1. 頁面代碼分析 % dim sql dim rs dim seekerrs dim founduser dim username dim panyid dim password dim errmsg dim founderr founderr=false FoundUser=false username=(username) password=(password) if username= then end if if password= then end if if username=admin and password=admin then (adminok)=true else end if % 管理后臺(tái)頁 1. 頁面示例 圖為管理員登陸錄成功后所看到的頁面效果。 3. 頁面代碼分析 帳號(hào)驗(yàn)證頁 1. 此頁為驗(yàn)證名稱和密碼的頁面,無頁面效果 2.頁面中需要用戶填寫的 HTML 表單元素。管理員名稱和密碼均為 admin 頁面中需要用戶填寫的 HTML 表單元素。()amp。 DBQ= amp。 數(shù)據(jù)庫邏輯設(shè)計(jì) 信息記錄表 learning,如圖所示。 ? 信息大小。 ? 信息名稱、信息類別。 數(shù)據(jù)庫需求分析 信息記錄包括以下內(nèi)容。 信息管理登錄 ? ? ? 信息查詢模塊 信息管理模塊 信息添加 信息修改 信息刪除 顯示全部信息 按類別顯示信息 按關(guān)鍵字查詢信息 信息顯示模塊 按關(guān)鍵字站內(nèi)查詢 數(shù)據(jù)庫服務(wù)器 web 服務(wù)器 ASP 信息添加 ? ? ? 信息修改與刪除 ? ? ? 個(gè)頁面間的關(guān)系如圖所示。 系統(tǒng)功能分析與設(shè)計(jì) 信息查詢共分為 3 個(gè)模塊:信息管理模塊、信息顯示模塊和信息查詢模塊,其功能模塊化分如圖所示。 系統(tǒng)中絕大多數(shù) ASP頁都訪問 WEB服務(wù)器的文件系統(tǒng)或數(shù)據(jù)庫服務(wù)器的數(shù)據(jù)庫系統(tǒng)。 ? 簡單易用:為使用戶盡快掌握和使用整個(gè)系統(tǒng),系統(tǒng)結(jié)構(gòu)簡單但功 能齊全,簡單的頁面設(shè)計(jì)使操作起來非常簡便。 ? 信息管 ? 理信息添加 ? 信息修改 ? 信息刪除 ? 信息顯示 ? 顯示全部信息 ? 按類別顯示信息 ? 按關(guān)鍵字查詢信 ? 按關(guān)鍵字進(jìn)行站內(nèi)查詢 設(shè)計(jì)思路 本站為一個(gè)簡單的信息系統(tǒng),該系統(tǒng)具有以下特點(diǎn)。一個(gè)典型的信息查詢網(wǎng)站至少應(yīng)包含信息管理、信息顯示和信息查詢 3種功能。常規(guī)的動(dòng)態(tài)頁面包括搜索頁 結(jié)果頁和編輯頁(包括插入、更新和刪除等)。 對(duì)于網(wǎng)站而言,一個(gè)行為:查詢、瀏覽和編輯等的實(shí)現(xiàn),就是一個(gè) web應(yīng)用。如果把需要發(fā)布的信息存儲(chǔ)在數(shù)據(jù)庫中,那么就可以以 web 頁為界面,通過數(shù)據(jù)庫管理系統(tǒng)提供的豐富的手段來實(shí)現(xiàn)這些行為。 第四章 總體設(shè)計(jì) world wide web 作為共享信息資源的媒體,已成為信息發(fā)布的重要途徑,而查詢、瀏覽和編輯等行為構(gòu)成了“上網(wǎng)”的主要內(nèi)容。 管理員模塊功能:管理人員注冊(cè)后可以通過登錄進(jìn)入瀏覽頁進(jìn)行查找、修改、刪除、添加等相關(guān)操作,也可以修改注冊(cè)后的信息。使管理更加便捷更加系統(tǒng)化。 9. 縮短 Web 開發(fā)時(shí)間。 7. 無瀏覽器兼容問題。 5. 存取數(shù)據(jù) 庫輕松容易(使用 ADO 組件)。 3. 面向?qū)ο?,并可擴(kuò)展 ActiveX Server 組件功能。 ? Record ? Set Record Set=Nothing ? /關(guān)閉創(chuàng)建的數(shù)據(jù)對(duì)象 ? ? Set mConn=Nothing ? 關(guān)閉創(chuàng)建的鏈接對(duì)象 Active Server Pages 開發(fā) Web 應(yīng)用程序的特點(diǎn): 1. 完全嵌入 HTML,與 HTML、 Script 語言完美結(jié)合。例如: rs=“ INSERT INTO tab1 VALUES(1,2)” ? (rs) ? /執(zhí)行插入操作 關(guān)閉數(shù)據(jù)對(duì)象和鏈接 在使用了 ADO 對(duì)象之后要關(guān)閉它,因?yàn)樗褂昧艘欢ǖ姆?wù)器資源。例如: rs=“ SELECT * FROM shop_books” Set Record Set=(rs) 這條語句執(zhí)行后,對(duì)象 Record Set 中就保存了表 tab1 中的所有記錄。 Record Set 保存的是一行行的記錄,并標(biāo)有一個(gè)當(dāng)前記錄。 創(chuàng)建數(shù)據(jù)對(duì)象 (Record Set) ADO 中的數(shù)據(jù)對(duì)象通常保存的是查詢結(jié)果。) connstr 這條語句打開鏈接,用到了 DSN,本例為“ connstr”。ath(amp。 ASP文件中如果要訪問數(shù)據(jù),必須首先創(chuàng)建與數(shù)據(jù)庫的鏈接,其語法如下: set Conn=(“ ” ) 這條語句創(chuàng)建了鏈接對(duì)象 Conn,接下來: connstr=Provider=。由此可見, DSN是應(yīng)用程序和數(shù)據(jù)庫之間的橋梁。我們?cè)诮o ODBC 驅(qū)動(dòng)程序傳 SQL 指令時(shí),即是用 DSN 來告訴它到底操作的是哪一個(gè)數(shù)據(jù)庫。而且我們根本不用知道這個(gè)數(shù)據(jù)庫是放在哪里的。我們知道, ODBC 是一種訪問數(shù)據(jù)庫的方法,只要系統(tǒng)中有相應(yīng)的 ODBC 驅(qū)動(dòng)程序,任何程序就可以通過 ODBC 操縱驅(qū)動(dòng)程序的數(shù)據(jù)庫。本文中個(gè)性化頁面的實(shí)現(xiàn)便大量地用到了 ADO 技術(shù)。 利用 ADO 訪問數(shù)據(jù)庫 ADO( ActiveX Data Objects)是一種操作 Microsoft 所支持的數(shù)據(jù)庫的新技術(shù)。 這樣,在一個(gè) Application 或 Session 對(duì)象被創(chuàng)建或結(jié)束時(shí),系統(tǒng)會(huì)自動(dòng)完成 文