ASPNET程序設(shè)計實習(xí)報告_第1頁
ASPNET程序設(shè)計實習(xí)報告_第2頁
ASPNET程序設(shè)計實習(xí)報告_第3頁
ASPNET程序設(shè)計實習(xí)報告_第4頁
ASPNET程序設(shè)計實習(xí)報告_第5頁
已閱讀5頁,還剩13頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、天津農(nóng)學(xué)院ASP.NET程序設(shè)計教學(xué)實習(xí)報告題目:簡易借書管理網(wǎng)站學(xué) 號: 2 姓 名:雷培倫 專 業(yè): 計算機信息管理_ 班 級: 13級計管1班_ 成 績: 17 / 18文檔可自由編輯打印1 背景與目的 ASP.NET課程設(shè)計是本學(xué)期的一本很重要的專業(yè)課,本次課程設(shè)計就是為了檢測本學(xué)期對這本書的掌握情況。本次課程設(shè)計也將作為期末考評。2 開發(fā)環(huán)境與開發(fā)工具 網(wǎng)站開發(fā)環(huán)境:Microsoft Visual Studio 2010集成開發(fā)環(huán)境。 網(wǎng)站開發(fā)語言:C#。 數(shù)據(jù)庫:Microsoft Visual Studio 2010內(nèi)置數(shù)據(jù)庫。 開發(fā)環(huán)境運行平臺:Windows 7。3 主要功

2、能 主要實現(xiàn)了簡單的登錄功能、注冊功能和基本的增刪查改的功能。4 設(shè)計與實現(xiàn)4.1 數(shù)據(jù)庫設(shè)計與實現(xiàn) 表1 用戶表序號 字段名 類型 長度 索引 備注1 工號 Int 標(biāo)識列 自動編號2 密碼 Varchar 503 級別 Char 50表2 圖書表序號 字段名 類型 長度 索引 備注1 圖書編號 Int 50 標(biāo)識列 自動編號2 圖書名稱 Char 503 出版社編號 Varchar 504 作者 Char 505 價格 Char 506 ISBN Varchar 507 狀態(tài) Char 508 類型編號 Varchar 509 出版日期 Date 5010 內(nèi)容提要 Varchar 50表

3、3借書表序號 字段名 類型 長度 索引 備注1 工號 Int 50 標(biāo)識列 自動編號2 圖書編號 Char 503 圖書名稱 Char 50表4出版社表序號 字段名 類型 長度 索引 備注1 出版社編號 Int 50 標(biāo)識列 自動編號2 出版社名稱 Char 50表5出版社表序號 字段名 類型 長度 索引 備注1 出版社編號 Int 50 標(biāo)識列 自動編號2 出版社名稱 Char 50表6圖書類型表序號 字段名 類型 長度 索引 備注1 圖書名稱 Int 50 2 類型編號 Char 50表7預(yù)約表序號 字段名 類型 長度 索引 備注1 圖書編號 Int 50 標(biāo)識列 自動編號2 圖書名稱 C

4、har 508 類型編號 Varchar 509 工號 Date 504.2 系統(tǒng)設(shè)計與實現(xiàn)4.2.1構(gòu)建網(wǎng)站配置文件、全局文件。 配置文件關(guān)鍵代碼:<connectionStrings><add name="connstr" connectionString="server=MM-PCSQLEXPRESS;database=shixun;integrated security=true;" providerName="System.Date.SqlClient"/><add name="shi

5、xunConnectionString" connectionString="Data Source=MM-PCSQLEXPRESS;Initial Catalog=shixun;Integrated Security=True" providerName="System.Data.SqlClient"/><add name="shixunConnectionString2" connectionString="Data Source=MM-PCSQLEXPRESS;Initial Catalog=sh

6、ixun;Integrated Security=True" providerName="System.Data.SqlClient"/><add name="shixunConnectionString3" connectionString="Data Source=MM-PCSQLEXPRESS;Initial Catalog=shixun;Integrated Security=True" providerName="System.Data.SqlClient"/><add

7、name="shixunConnectionString4" connectionString="Data Source=MM-PCSQLEXPRESS;Initial Catalog=shixun;Integrated Security=True" providerName="System.Data.SqlClient"/><add name="shixunConnectionString5" connectionString="Data Source=MM-PCSQLEXPRESS;Ini

8、tial Catalog=shixun;Integrated Security=True" providerName="System.Data.SqlClient"/><add name="shixunConnectionString6" connectionString="Data Source=MM-PCSQLEXPRESS;Initial Catalog=shixun;Integrated Security=True" providerName="System.Data.SqlClient&quo

9、t;/><add name="shixunConnectionString7" connectionString="Data Source=MM-PCSQLEXPRESS;Initial Catalog=shixun;Integrated Security=True" providerName="System.Data.SqlClient"/></connectionStrings>4.2.2主頁面的設(shè)計4.2.3登錄頁面的設(shè)計。public partial class 登錄頁面: System.Web.

10、UI.Page protected void Page_Load(object sender, EventArgs e) protected void Button1_Click(object sender, EventArgs e) string gh = id1.Text; string mm = id2.Text; string sql = "select 工號,密碼 from 用戶表 where 工號='" + gh + "'and 密碼='" + mm + "' " SqlConnection

11、 conn = new SqlConnection("server=MM-PCSQLEXPRESS;Database=shixun;Integrated Security=true;"); SqlCommand cmd = new SqlCommand(sql, conn); conn.Open(); string id; try id = cmd.ExecuteScalar().ToString(); catch id = null; finally cmd.Dispose(); conn.Close(); conn.Dispose(); if (id != null)

12、Session"密碼" = mm; Session"工號" = gh; Response.Redirect("首頁.aspx"); else this.Label1.Visible = true; this.Label1.Text = "用戶名或密碼錯誤" 運行頁面圖片:4.2.4修改密碼頁面的設(shè)計,修改密碼成功后返回登錄頁面。public partial class altpwd : System.Web.UI.Page protected void Page_Load(object sender, EventA

13、rgs e) Label1.Text = Session"工號".ToString(); protected void Button1_Click(object sender, EventArgs e) string ymm = T1.Text.Trim(); string xmm = T2.Text.Trim(); string qrmm= T3.Text.Trim(); SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConfigurationManager.ConnectionStri

14、ngs"connstr".ToString(); SqlCommand comm = new SqlCommand(); comm.Connection = conn; conn.Open(); comm.CommandText = string.Format("update 用戶表 set 密碼='0'where 工號='1'and 密碼='2'", xmm,Session"工號".ToString(),ymm); int n = comm.ExecuteNonQuery(); if

15、(n > 0) Response.Redirect("/登錄頁面.aspx"); Label1.Text = "密碼修改成功請重新登錄!" else Label1.Text = "密碼修改失敗!" comm.Dispose(); conn.Close(); conn.Dispose(); 運行頁面圖片:4.2.5添加用戶頁面的設(shè)計。public partial class 添加用戶: System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) p

16、rotected void Button1_Click(object sender, EventArgs e) SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConfigurationManager.ConnectionStrings"connstr".ToString(); SqlCommand comm = new SqlCommand(); comm.Connection = conn; try conn.Open(); comm.CommandText = string.Forma

17、t("insert 用戶表(工號,姓名,教研室,密碼,狀態(tài),級別) values('0','1','2','3','4','5')",T1.Text.Trim(),T2.Text.Trim(),T3.Text.Trim(),T4.Text.Trim(),T5.SelectedValue,T6.SelectedValue); int n = comm.ExecuteNonQuery(); if (n > 0) Response.Redirect("/登錄頁面.asp

18、x"); else Label2.Visible = true; Label2.Text = "登錄失敗!" catch (Exception ex) Label2.Visible = true; Label2.Text = ex.Message.ToString(); finally comm.Dispose(); conn.Close(); conn.Dispose(); 運行頁面圖片:4.2.6添加圖書頁面的設(shè)計。public partial class addbook : System.Web.UI.Page protected void Page_Loa

19、d(object sender, EventArgs e) protected void Button1_Click(object sender, EventArgs e) string a_1 = T1.Text.Trim(); string a_2 = T2.Text.Trim(); string a_3 = T3.Text.Trim(); string a_4 = T4.Text.Trim(); string a_5 = T5.Text.Trim(); string a_6 = T6.Text.Trim(); string a_7 = T7.SelectedValue; string a

20、_8 = T7.Text.Trim(); string a_9 = T9.Text.Trim(); string a_10 =T10.Text.Trim(); SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConfigurationManager.ConnectionStrings"connstr".ToString(); SqlCommand comm = new SqlCommand(); comm.Connection = conn; try conn.Open(); comm.Co

21、mmandText = string.Format("insert 圖書表(圖書編號,圖書名稱,出版社編號,作者,價格,ISBN,狀態(tài),類型編號,出版日期,內(nèi)容提要)values('0','1','2','3','4','5','6','7','8','9')",a_1,a_2,a_3,a_4,a_5,a_6,a_7,a_8,a_9,a_10); int n = comm.ExecuteNonQuery(); if

22、(n > 0) Label1.Visible = true; Label1.Text = "添加圖書成功!" else Label1.Visible = true; Label1.Text = "添加圖書失?。?quot; catch (Exception ex) Label1.Visible = true; Label1.Text = ex.Message.ToString(); finally comm.Dispose(); conn.Close(); conn.Dispose(); 運行頁面圖片:4.2.7注銷圖書頁面的設(shè)計。 注銷圖書主要是連接數(shù)據(jù)庫

23、用Gridview顯示查詢,然后跳轉(zhuǎn)到詳細(xì)信息頁面,顯示詳細(xì)信息和刪除圖書。public partial class bookinfo : System.Web.UI.Page string tsbh; SqlConnection conn = new SqlConnection(); SqlCommand comm = new SqlCommand();/string tsbh =Request.QueryString"id" protected void Page_Load(object sender, EventArgs e) tsbh =Request.QueryS

24、tring"id" conn.ConnectionString = ConfigurationManager.ConnectionStrings"connstr".ToString(); comm.Connection = conn; try conn.Open(); comm.CommandText = string.Format("select 圖書編號,圖書名稱,作者,出版社名稱,出版日期,內(nèi)容提要 from 圖書表 a,出版社表 b where a.出版社編號=b.出版社編號 and 圖書編號='0'", ts

25、bh); SqlDataReader sdr = comm.ExecuteReader(); while (sdr.Read() l_tsbh.Text = sdr"圖書編號".ToString(); l_sm.Text = sdr"圖書名稱".ToString(); l_zz.Text = sdr"作者".ToString(); l_cbs.Text = sdr"出版社名稱".ToString(); l_cbrq.Text = sdr"出版日期".ToString(); l_nrty.Text = sdr"內(nèi)容提要".ToString(); catch (Exception ex) l_sm.Text = ex.Message.ToString(); finally comm.Dispose(); conn.Close(); conn.Dispose(); protected void Button1_Click1(object sender, EventArgs e) conn.ConnectionString = ConfigurationManager.ConnectionStrings"connst

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論