




版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、 仲愷仲愷數(shù)據(jù)庫原理及應用數(shù)據(jù)庫原理及應用Principles and Applications of the Database 第第1111章章 基于基于ASP.NETASP.NET的圖書管理系統(tǒng)的圖書管理系統(tǒng)仲愷農(nóng)業(yè)工程學院仲愷農(nóng)業(yè)工程學院 計算機科學與工程學院計算機科學與工程學院http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ htt
2、p:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 第第11章章 基于基于ASP.NET的圖書管理系統(tǒng)的圖書管理系統(tǒng)v本章導讀本章導讀 了解:了解:SQL Server 2005網(wǎng)頁布局創(chuàng)建網(wǎng)頁布局創(chuàng)建 理解:理解:ASP.NET網(wǎng)站的創(chuàng)建過程網(wǎng)站的創(chuàng)建過程 掌握:掌握:ASP.NET網(wǎng)站的構架、各個部分的組成、網(wǎng)站的
3、構架、各個部分的組成、C#訪問數(shù)據(jù)庫技術、訪問數(shù)據(jù)庫技術、C#內(nèi)部數(shù)據(jù)處理及顯示內(nèi)部數(shù)據(jù)處理及顯示http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ ht
4、tp:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 第第11章章 基于基于ASP.NET的圖書管理系統(tǒng)的圖書管理系統(tǒng)v重點:重點: 1 ASP.NET網(wǎng)站的編程網(wǎng)站的編程 2 ASP.NET網(wǎng)站的訪問數(shù)據(jù)庫技術網(wǎng)站的訪問數(shù)據(jù)庫技術v難點:難點: 1SQL Server 2005存儲過程的參數(shù)傳遞存儲過程的參數(shù)傳遞 2SQL Server 2005聚集計算聚集計算http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ ht
5、tp:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/
6、http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 第第11章章 基于基于ASP.NET的圖書管理系統(tǒng)的
7、圖書管理系統(tǒng)v本章要點本章要點 SQL Server 2005數(shù)據(jù)庫、表、存儲過程的創(chuàng)建數(shù)據(jù)庫、表、存儲過程的創(chuàng)建 ASP.Net網(wǎng)站的創(chuàng)建網(wǎng)站的創(chuàng)建 頁面框架設計頁面框架設計 圖書管理系統(tǒng)的登錄管理圖書管理系統(tǒng)的登錄管理 圖書管理系統(tǒng)的系統(tǒng)管理員管理圖書管理系統(tǒng)的系統(tǒng)管理員管理 圖書管理系統(tǒng)的圖書管理員管理圖書管理系統(tǒng)的圖書管理員管理 圖書管理系統(tǒng)的讀者模塊管理圖書管理系統(tǒng)的讀者模塊管理http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/
8、 http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 第第11章章 基于基于ASP.NET的圖書管理系統(tǒng)的圖書管理系統(tǒng)11.1 創(chuàng)建創(chuàng)建SQL Server 2005數(shù)據(jù)庫數(shù)據(jù)庫11.2 創(chuàng)建圖書管理系統(tǒng)網(wǎng)站創(chuàng)建圖書
9、管理系統(tǒng)網(wǎng)站11.3 公用模塊編寫公用模塊編寫11.4 登錄模塊登錄模塊11.5 系統(tǒng)管理員管理系統(tǒng)管理員管理11.6 圖書管理員管理圖書管理員管理11.7 讀者管理讀者管理本章小結本章小結http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/ww
10、w.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.1 創(chuàng)建創(chuàng)建SQL Server 2005數(shù)據(jù)庫數(shù)據(jù)庫11.1.1 11.1.1 創(chuàng)建數(shù)據(jù)庫創(chuàng)建數(shù)據(jù)庫11.1.2 11.1.2 創(chuàng)建數(shù)據(jù)表創(chuàng)建數(shù)據(jù)表11.1.3 11.1.3 創(chuàng)建存儲過程創(chuàng)建存儲過程http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ h
11、ttp:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.1.1 11.1.1 創(chuàng)建數(shù)據(jù)庫創(chuàng)建數(shù)據(jù)庫v在在SQL Server Management Studio
12、中創(chuàng)中創(chuàng)建數(shù)據(jù)庫建數(shù)據(jù)庫v利用利用T-SQL語句創(chuàng)建數(shù)據(jù)庫語句創(chuàng)建數(shù)據(jù)庫http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ h
13、ttp:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 1在在SQL Server Management Studio中創(chuàng)建數(shù)據(jù)庫中創(chuàng)建數(shù)據(jù)庫v “常規(guī)常規(guī)”選擇頁選擇頁 v “選項選項”選擇頁選擇頁 v “文件組文件組”選擇頁選擇頁 http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http
14、:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 2利用利用T-SQL語句創(chuàng)建數(shù)據(jù)庫語句創(chuàng)建數(shù)據(jù)庫CREATE DATABASE LibraryLib ON ( NAME=LibraryLib_data, /*指定文件的邏輯名稱指定文件的邏輯名稱*/ FILENAME=C:LibraryLibLibrar
15、yLib_data.mdf, SIZE=4, MAXSIZE=10, /*指定最大的文件大小指定最大的文件大小*/ FILEGROWTH=10%) /*指定文件增長的百分比指定文件增長的百分比*/ LOG ON ( NAME=LibraryLib_log, /*指定文件的邏輯名稱指定文件的邏輯名稱*/ FILENAME=C: LibraryLibLibraryLib_log.mdf, SIZE=1, /*指定文件大小指定文件大小*/ MAXSIZE=6, /*指定最大的文件大小指定最大的文件大小*/ FILEGROWTH=1) /*指定文件增長的增量指定文件增長的增量*/ GOhttp:/ h
16、ttp:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/
17、 http:/ http:/ 11.1 創(chuàng)建創(chuàng)建SQL Server 2005數(shù)據(jù)庫數(shù)據(jù)庫11.1.1 11.1.1 創(chuàng)建數(shù)據(jù)庫創(chuàng)建數(shù)據(jù)庫11.1.2 11.1.2 創(chuàng)建數(shù)據(jù)表創(chuàng)建數(shù)據(jù)表11.1.3 11.1.3 創(chuàng)建存儲過程創(chuàng)建存儲過程http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg-
18、 http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.1.2 創(chuàng)建數(shù)據(jù)表創(chuàng)建數(shù)據(jù)表v圖書管理系統(tǒng)數(shù)據(jù)庫圖書管理系統(tǒng)數(shù)據(jù)庫8個表個表v增加了一個系統(tǒng)用戶權限表主要是為了對用戶分增加了一個系統(tǒng)用戶權限表主要是為了對用戶分類:系統(tǒng)管理員、圖書管理員、讀者類:系統(tǒng)管理員、圖書管理員、讀者v有些字段與設計時稍微有些區(qū)別,主要是為了編有些字段與設計時稍微有些區(qū)別,主要是為了
19、編程的方便、更加符合實際需要改動的程的方便、更加符合實際需要改動的 http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ htt
20、p:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.1.2 創(chuàng)建數(shù)據(jù)表創(chuàng)建數(shù)據(jù)表1SQLServer Management Studio圖形模圖形模式創(chuàng)建表式創(chuàng)建表2T-SQL語句模式創(chuàng)建表語句模式創(chuàng)建表http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ htt
21、p:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 1SQLServer Management Studio圖形模式創(chuàng)建表圖形模式創(chuàng)建表http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ h
22、ttp:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 1SQLServer Management Studio圖形模式創(chuàng)建表圖形模式創(chuàng)建表http:/ http:/ http:/ http:/ http:/
23、 http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 1SQLServer
24、Management Studio圖形模式創(chuàng)建表圖形模式創(chuàng)建表http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/
25、 http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 2T-SQL語句模式創(chuàng)建表語句模式創(chuàng)建表vSET ANSI_NULLS ONvGOvSET QUOTED_IDENTIFIER ONvGOvIF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(Ndbo.Users) AND type in (NU)vBEGINvCREATE TABLE dbo.Users(vUserID varchar(20) NOT NULL,vUserPassword varcha
26、r(20) NOT NULL,vUserPower int NOT NULL,vUserName varchar(20) NOT NULL,vUserSex bit NOT NULL,vUserDepart varchar(40) NOT NULL,vUserTelephone varchar(14) NULL,vUserEMail varchar(30) NULL,vUserInSystemDate datetime NULL,vUserBorrowedBooks int NOT NULL CONSTRAINT DF_Users_UserBorrowedBooks DEFAULT (0),v
27、 CONSTRAINT PK_Users PRIMARY KEY CLUSTERED v(vUserID ASCv)WITH (IGNORE_DUP_KEY = OFF) ON PRIMARYv) ON PRIMARYvENDvGOhttp:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- ht
28、tp:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.1 創(chuàng)建創(chuàng)建SQL Server 2005數(shù)據(jù)庫數(shù)據(jù)庫11.1.1 11.1.1 創(chuàng)建數(shù)據(jù)庫創(chuàng)建數(shù)據(jù)庫11.1.2 11.1.2 創(chuàng)建數(shù)據(jù)表創(chuàng)建數(shù)據(jù)表11.1.3 11.1.3 創(chuàng)建存儲過程創(chuàng)建存儲過程http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ h
29、ttp:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.1.3 創(chuàng)建存儲過程創(chuàng)建存儲過程v用戶的添加存儲過程用戶的添加
30、存儲過程Proc_UsersAddvCREATE PROCEDURE dbo.Proc_UsersAddv(UserIDvarchar(50), UserPassword varchar(50),v UserPower int, UserName varchar(50),v UserSex bit, UserDepart varchar(50),v UserTelephone varchar(50), UserEMail varchar(50)vAS INSERT INTO dbo.Users v (UserID,UserPassword,UserPower,UserName,UserSex,
31、 UserDepart, UserTelephone, UserEMail) vVALUES v( UserID, UserPassword, UserPower, UserName,v UserSex, UserDepart, UserTelephone, UserEMail)http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/
32、 http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 第第11章章 基于基于ASP.NET的圖書管理系統(tǒng)的圖書管理系統(tǒng)11.1 創(chuàng)建創(chuàng)建SQL Server 2005數(shù)據(jù)庫數(shù)據(jù)庫11.2 創(chuàng)建圖書管理系統(tǒng)網(wǎng)站創(chuàng)建圖書管理系統(tǒng)網(wǎng)站11.3 公用模塊編寫公用模塊編寫11.4 登錄模塊登錄模塊11.5 系統(tǒng)管理員管理系統(tǒng)管理員管理1
33、1.6 圖書管理員管理圖書管理員管理11.7 讀者管理讀者管理本章小結本章小結http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:
34、/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.2 創(chuàng)建圖書管理系統(tǒng)網(wǎng)站創(chuàng)建圖書管理系統(tǒng)網(wǎng)站11.2.1 IIS服務器創(chuàng)建網(wǎng)站服務器創(chuàng)建網(wǎng)站11.2.2 用用Visual Studio 2005來創(chuàng)建一個網(wǎng)站來創(chuàng)建一個網(wǎng)站http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ h
35、ttp:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 第第11章章 基于基于ASP.NET的圖書管理系統(tǒng)的圖書管理系統(tǒng)11.1 創(chuàng)建創(chuàng)建SQL Server 2005數(shù)據(jù)庫數(shù)據(jù)庫11.2 創(chuàng)建圖書管理系統(tǒng)網(wǎng)站創(chuàng)建圖書管理系統(tǒng)網(wǎng)站11.3 公用模塊編寫公用模塊編寫11.4 登錄模塊登錄模塊11.5 系統(tǒng)管
36、理員管理系統(tǒng)管理員管理11.6 圖書管理員管理圖書管理員管理11.7 讀者管理讀者管理本章小結本章小結http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/
37、http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.3 公用模塊編寫公用模塊編寫11.3.1 數(shù)據(jù)庫連接編寫數(shù)據(jù)庫連接編寫11.3.2 數(shù)據(jù)庫操作數(shù)據(jù)庫操作DataBase類類11.3.3 圖書信息圖書信息Book類類11.3.3 借還借還Borrow類類11.3.3 用戶信息用戶信息Users類類http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ h
38、ttp:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.3.1 數(shù)據(jù)庫連接編寫數(shù)據(jù)庫連接編寫v v v http:/ http:/ http:/ http:/ http:/ http:/ http:/
39、http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.3 公用模塊編寫公用模塊編寫11.3.1 數(shù)據(jù)
40、庫連接編寫數(shù)據(jù)庫連接編寫11.3.2 數(shù)據(jù)庫操作數(shù)據(jù)庫操作DataBase類類11.3.3 圖書信息圖書信息Book類類11.3.3 借還借還Borrow類類11.3.3 用戶信息用戶信息Users類類http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- ht
41、tp:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.3.2 數(shù)據(jù)庫操作數(shù)據(jù)庫操作DataBase類類vpublic class DataBasepublic class DataBase vprotected SqlConnection Connection; /SQLprotected SqlConnection Connection; /SQL連接對象,每個用戶只保存一個連接對象,每個用戶只
42、保存一個v protected string ConnectionString; / protected string ConnectionString; /系統(tǒng)獲取系統(tǒng)獲取vpublic DataBase()public DataBase(); /獲取獲取Web.ConfigWeb.Config數(shù)據(jù)庫訪問串保存私有字符串變量數(shù)據(jù)庫訪問串保存私有字符串變量vprivate void Open()private void Open();/打開數(shù)據(jù)庫連接,連接保存自傲私有變量中。打開數(shù)據(jù)庫連接,連接保存自傲私有變量中。vpublic void Close()public void Close();
43、/關閉數(shù)據(jù)庫連接關閉數(shù)據(jù)庫連接vDataBase()DataBase();/析構函數(shù),釋放非托管資源析構函數(shù),釋放非托管資源vpublic void Dispose()public void Dispose();/釋放資源釋放資源vpublic bool GetRecord(string XSqlString)public bool GetRecord(string XSqlString);/ Sql/ Sql語句返回是否查到記錄語句返回是否查到記錄vpublic int GetRecordCount(string XSqlString)public int GetRecordCount(st
44、ring XSqlString);/返回返回SqlSql語句獲得的數(shù)據(jù)值語句獲得的數(shù)據(jù)值v /根據(jù)根據(jù)XWhereXWhere更新數(shù)據(jù)表更新數(shù)據(jù)表XTableNameXTableName中的某些紀錄,中的某些紀錄,XTableName-XTableName-表名表名vpublic DataSet AdvancedSearch(string XTableName, Hashtable XHT)public DataSet AdvancedSearch(string XTableName, Hashtable XHT);v /用于查詢指定的讀者有沒有超期罰款沒有繳納,獲取超期圖書的列表信息用于查詢
45、指定的讀者有沒有超期罰款沒有繳納,獲取超期圖書的列表信息v public DataSet AdvancedSearchFee(string strUserID) public DataSet AdvancedSearchFee(string strUserID); http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/
46、 http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.3.2 數(shù)據(jù)庫操作數(shù)據(jù)庫操作DataBase類類v/用于查詢指定的讀者超期圖書罰款的總額用于查詢指定的讀者超期圖書罰款的總額v public double GetUserTotalFee(string strUserID) public double GetUserTotalFee
47、(string strUserID);v public int TurnInUserFee(string strUserID) public int TurnInUserFee(string strUserID);/指定的用戶交齊了罰款指定的用戶交齊了罰款v private SqlCommand CreateCommand(string ProcName, SqlParameter Prams); private SqlCommand CreateCommand(string ProcName, SqlParameter Prams);v public SqlParameter MakePar
48、am(string ParamName, SqlDbType DbType, Int32 Size, public SqlParameter MakeParam(string ParamName, SqlDbType DbType, Int32 Size, ParameterDirection Direction, object Value) ;ParameterDirection Direction, object Value) ; / /實例化一個用于調用存儲過程的參數(shù)實例化一個用于調用存儲過程的參數(shù)v public SqlParameter MakeInParam(string Para
49、mName, SqlDbType DbType, int Size, public SqlParameter MakeInParam(string ParamName, SqlDbType DbType, int Size, object Value) ; /object Value) ; /實例化一個用于調用存儲過程的輸入?yún)?shù)實例化一個用于調用存儲過程的輸入?yún)?shù)v public int RunProc(string ProcName) ; public int RunProc(string ProcName) ; /調用存儲過程調用存儲過程( (不帶參數(shù)不帶參數(shù)) )v public int
50、 RunProc(string ProcName, SqlParameter Params); / public int RunProc(string ProcName, SqlParameter Params); /存儲過程存儲過程( (帶參數(shù)帶參數(shù)) )v public SqlDataReader RunProcGetReader(string ProcName);public SqlDataReader RunProcGetReader(string ProcName);v public SqlDataReader RunProcGetReader(string ProcName, Sq
51、lParameter Params); public SqlDataReader RunProcGetReader(string ProcName, SqlParameter Params); v public int RunProcGetCount(string ProcName, SqlParameter Params);public int RunProcGetCount(string ProcName, SqlParameter Params);v public DataSet GetDataSet(string ProcName); / public DataSet GetDataS
52、et(string ProcName); /調用存儲過程調用存儲過程( (不帶參數(shù)不帶參數(shù)) )v public DataSet GetDataSet(string ProcName, SqlParameter Params);public DataSet GetDataSet(string ProcName, SqlParameter Params);http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ htt
53、p:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.3 公用模塊編寫公用模塊編寫11.3.1 數(shù)據(jù)庫連接編寫數(shù)據(jù)庫連接編寫11.3.2 數(shù)據(jù)庫操作數(shù)據(jù)庫操作DataBase類類11.3.3 圖書信息圖書信息Book類類11.3.3 借還借還Bo
54、rrow類類11.3.3 用戶信息用戶信息Users類類http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ ht
55、tp:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.3.3 圖書信息圖書信息Book類類v public class Bookv /Book類的私有數(shù)據(jù)成員類的私有數(shù)據(jù)成員v private int _bookID; /書順序號書順序號v private string _bookName; /書名書名v private string _bookISBN; /ISBNv private string _bookAuthor; /作者作者v private int _bookPublishID; /出版社的順序號出版社的順序號v privat
56、e DateTime _bookPublishDate; /出版時間出版時間v private int _bookClassID; /圖書類別圖書類別v private string _bookSubject; /主題主題v private double _bookPrice; /價格價格v private int _bookPageNum; /頁數(shù)頁數(shù)v private string _bookSeries; /圖書系列圖書系列v private string _bookDescription; /描述描述v private int _bookNum; /本書的總數(shù)本書的總數(shù)v privat
57、e int _bookCurNum; /本書的當前庫存本書的當前庫存v private string _bookPublishName; /圖書出版社的名稱圖書出版社的名稱v private string _bookClassName; /圖書的類別名稱圖書的類別名稱v private int _bookBorrowDays; /圖書可以借出的天數(shù)圖書可以借出的天數(shù)v private double _bookFee; /超期罰款的金額超期罰款的金額http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http
58、:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.3.3 圖書信息圖書信息Book類類v/Book類的屬性實現(xiàn)類的屬性實現(xiàn)v public int
59、 BookID v set v this._bookID = value;v v get v return this._bookID;v v v public string BookName v set v this._bookName = value;v v get v return this._bookName;v v v/其他屬性類似定義實現(xiàn)其他屬性類似定義實現(xiàn)http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ htt
60、p:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/ http:/www.zg- http:/www.skf- http:/www.nsk- http:/www.fag- http:/www.ntn- http:/ http:/ http:/ http:/ http:/ http:/www.xunchi- http:/ http:/ http:/ http:/ 11.3.3 圖書信息圖書信息Book類類v /Book類的方法類的方法v public bool LoadData(int XBookID);/根據(jù)書順序號根據(jù)書順序號 BookID
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 工程居間合同范本
- 上海供貨服裝合同范例
- 廚師績效合同范本
- 合同范例作廢文本
- 代課教師聘用合同范例
- 合同范本打賭
- 廠區(qū)勞務合同范例
- 合同范本修訂調研方案
- 北京官方合同范本
- 報社發(fā)布廣告合同范本
- 2023年中國鐵路南寧局招聘筆試參考題庫附帶答案詳解
- 某鐵路注漿處理工藝性試驗方案
- GB/T 12265-2021機械安全防止人體部位擠壓的最小間距
- GB 8537-2018食品安全國家標準飲用天然礦泉水
- GB 31247-2014電纜及光纜燃燒性能分級
- 婚禮開場白主持詞15篇
- 部編人教版道德與法治五年級下冊全冊課時練習講解課件
- 識讀齒輪精測報告課件
- 《農(nóng)村土地承包法》課件
- 廉政鑒定書(院內(nèi)廉政意見書)
- 《潘姓源于固始,是不爭的史實》的考辨
評論
0/150
提交評論