




版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、-作者xxxx-日期xxxx數(shù)據(jù)庫實訓+郵局訂報管理系統(tǒng)【精品文檔】江蘇理工學院課程設計報告課程名稱 數(shù)據(jù)庫原理及應用 設計題目 郵局訂報管理系統(tǒng)姓 名 施坡 專業(yè)班級 12東計B 學 號 12961119 日期 2013-2-26 2012-3-9 成績 江蘇理工學院課程名稱數(shù)據(jù)庫原理及應用課程代碼設計題目郵局訂報管理系統(tǒng)設計時間2013年 2 月 26 日 2013 年3 月 9 日系(院)計算機科學與信息工程學院專業(yè)計算機科學與技術班級12961119課程設計任務(條件)、具體技術參數(shù)(指標)通過兩周的課程設計,要求學生加深對數(shù)據(jù)庫技術相關理論的理解,增強動手能力,掌握使用現(xiàn)行較為流行的
2、數(shù)據(jù)庫理論和數(shù)據(jù)庫開發(fā)工具進行數(shù)據(jù)庫管理操作(如建庫、建立完整性約束,對數(shù)據(jù)庫中數(shù)據(jù)進行查詢,更改等操作)的方法;具體應用方面,要求學生對SQL語言要有較深入的了解和掌握,對數(shù)據(jù)庫的管理(主要是安全性方面)要有一定程度的了解。本次課程設計包含兩大部分內(nèi)容:設計軟件和設計報告。其中設計軟件在題目驗收時由指導教師檢查,具體內(nèi)容不同,系統(tǒng)要求不同;設計報告作為書面材料提交。二、對課程設計成果的要求(包括課程設計說明書、圖紙、圖表、實物等軟硬件要求)1、每位同學提交設計的數(shù)據(jù)庫和應用程序相關文檔,并提交一份課程設計報告,內(nèi)容要包含設計題目、設計目的、需求分析、系統(tǒng)功能描述、系統(tǒng)E-R圖、關系模式設計、
3、各數(shù)據(jù)庫表的建立(代碼)、系統(tǒng)各功能實現(xiàn)(代碼)、系統(tǒng)功能評價等。2、課程設計報告電子版排版順序: 任務書 目錄 正文 附錄。3、每個同學要針對自己的系統(tǒng),寫出對設計技術的分析、對系統(tǒng)的測試、在編碼和調(diào)試過程中遇到的問題和解決方法等。4、課程設計報告最后寫出本次設計的心得體會。課程設計工作進度計劃課程設計第1周第1天:布置任務、交代課題、安排設計事宜第1周第2天:調(diào)研,書籍和資料的準備第1周第3天-第5天:系統(tǒng)分析和設計第2周第1天-第3天:編程和測試,撰寫設計報告第2周第4天-第5天:課程設計檢查,交設計報告四、主要參考資料1數(shù)據(jù)庫原理及應用 錢雪忠主編 北京郵電大學出版社 2012,6,
4、第三版.2012.2012.2012.2012目 錄一、需求分析1用戶需求1系統(tǒng)功能需求1系統(tǒng)軟硬件環(huán)境確定2二、系統(tǒng)功能設計2系統(tǒng)功能結(jié)構2系統(tǒng)功能處理流程2三、系統(tǒng)數(shù)據(jù)庫設計3數(shù)據(jù)庫概念設計3數(shù)據(jù)庫邏輯設計3數(shù)據(jù)庫物理設計3四、系統(tǒng)實現(xiàn)4數(shù)據(jù)庫連接的實現(xiàn)4用戶登錄功能的實現(xiàn)54.3 用戶訂購報紙功能的實現(xiàn)12用戶查看自己已訂閱報紙的功能的實現(xiàn)144.5 用戶退訂報紙功能的實現(xiàn)154.6 管理員查看報紙信息的實現(xiàn)16管理員查看用戶信息的實現(xiàn)174.8 管理員查看用戶訂閱信息的實現(xiàn)184.9 管理員進行搜索功能的實現(xiàn)194.10 管理員插入報紙功能的實現(xiàn)214.11 管理員刪除報紙功能的實現(xiàn)2
5、3關于26五、小結(jié)27六、參考文獻。28【精品文檔】一、需求分析1、可隨時查詢處可訂購報紙的詳細情況,如報紙編號(PNO)、報紙名稱(PNA)、報紙單價(5、版面規(guī)格(PSI)、出版單位(PDW)等,這樣便于客戶選定。2、客戶查詢報紙情況后即可訂購所需報紙,可訂購多種報紙,每種報紙可訂若干份,交清所需金額后,就算訂購處理完成。3、為便于郵局投遞報紙,客戶需寫明如下信息:客戶姓名(CAN)、電話(CAD)、地址(CAW)及郵政編碼(CAY),郵局將即時為每一客戶編制唯一代碼(CNA)。4、郵局對每種報紙訂購人數(shù)不限,每個客戶可多次訂購報紙,所定報紙亦可重復。5、 能對報紙、客戶等信息進行添加、修
6、改、刪除、查詢、打印等基本操作。6、 能根據(jù)訂報要求訂購各報紙,并完成一次訂購任務后匯總總金額,模擬付錢、開票操作。7、 能明細查詢某客戶的訂報情況及某報紙的訂出情況。8、 能統(tǒng)計出某報紙的總訂購量與總金額及某客戶訂購報紙種數(shù)、報紙份數(shù)與總訂購金額等。 1、在SQL Server中建立各相應的關系模式對應的庫表,并確定索引等。2、能對各庫表進行輸入,添加,修改,刪除,查詢,打印等基本操作。3、查詢功能:能根據(jù)郵局訂報管理系統(tǒng),管理員實現(xiàn)報紙的管理功能,用戶實現(xiàn)報紙訂閱和退訂功能。4、統(tǒng)計功能:能名細查詢每報紙的總訂數(shù)量與總金額及客戶訂購報紙種類,份數(shù)和總金額。5、要求子系統(tǒng)設計界面友好,功能操
7、作方便合理,并考慮子系統(tǒng)在安全性,完整性方面的功能要求。6用戶管理功能,如:用戶登陸等。1.3系統(tǒng)軟硬件環(huán)境確定系統(tǒng)開發(fā)工具為局域網(wǎng)或校園網(wǎng)網(wǎng)絡環(huán)境,網(wǎng)絡中有一臺安裝了windowsxp的服務器,服務器上安裝了SQL Server 2000,本子系統(tǒng)使用C#開發(fā)。二、系統(tǒng)功能設計1、查詢報紙2、訂報紙3、開票4、付錢結(jié)算5、訂購后的查詢6、統(tǒng)計圖2-1 系統(tǒng)流圖三、系統(tǒng)數(shù)據(jù)庫設計數(shù)據(jù)庫在一個信息管理系統(tǒng)中占有非常重要的地位,數(shù)據(jù)庫結(jié)構設計的好壞將直接決定對應用系統(tǒng)的效率以及實現(xiàn)的效果的影響。合理的數(shù)據(jù)庫結(jié)構設計可以提高數(shù)據(jù)存儲的效率,保證數(shù)據(jù)的完整和一致。同時,合理的數(shù)據(jù)庫也有利與應用系統(tǒng)程序
8、的實現(xiàn)。在充分的尋求分析基礎上,經(jīng)過逐步抽象,分析,充分研討,可畫出如下反映郵局訂報子系統(tǒng)數(shù)據(jù)的整體CANOCAYOCAWCADPNOPNPPRPSIPDWNUMsub_newscustomer_infoNews_infonm圖3-1 圖數(shù)據(jù)庫邏輯設計1、數(shù)據(jù)庫關系模式News_info(PNO,PN,PPR,PSI,PDW)報紙(報紙編號,報紙名稱,報紙價格,版面規(guī)格,出版單位)customer_info(CAN,CAD,CAW,CAY)客戶(客戶名稱,電話,地址,郵政編碼)sub_news(PNO,CAN,NUM)訂購(報紙編號,客戶名稱,數(shù)量)2、數(shù)據(jù)庫的視圖本系統(tǒng)使用的數(shù)據(jù)庫是SQL
9、2000,根據(jù)已設計出的關系模式及各關系模式的完整性約束要求,在SQL 2000數(shù)據(jù)庫系統(tǒng)中實現(xiàn)這些邏輯結(jié)構。數(shù)據(jù)庫表的創(chuàng)建本系統(tǒng)使用的數(shù)據(jù)庫名為newspaper下面是創(chuàng)建數(shù)據(jù)庫及其表結(jié)構的命令: CREATE TABLE LOGININ(CNO varCHAR(20) PRIMARY KEY,PSW varCHAR(20)CREATE TABLE Customer(CNO varCHAR(20) PRIMARY KEY,CNA varCHAR(50) ,CTE varCHAR(15),CAD varCHAR(50),CPO varCHAR(10),FOREIGN KEY(CNO) REFE
10、RENCES LOGININ(CNO)CREATE TABLE news_info (PNO varCHAR(20) PRIMARY KEY,PNA varCHAR(50) ,PPR FLOAT,PSI varCHAR(50),PDW varCHAR(50)CREATE TABLE Subcribe(CNO varCHAR(20),PNO varCHAR(20),NUM SMALLINT,FOREIGN KEY(CNO) REFERENCES LOGININ(CNO),FOREIGN KEY(PNO) REFERENCES news_info(PNO),PRIMARY KEY(CAN,PNO)
11、四、系統(tǒng)實現(xiàn)class connectionSqlConnection conn;public SqlConnection connectgetreturn this.conn;public void CreateConnection()conn = new SqlConnection(data source=.;initial catalog=SubcribPost;user ID=sa);this.conn.Open();SqlCommand command = this.conn.CreateCommand();static void Main()conn = new connectio
12、n();conn.CreateConnection();Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);Application.Run(new logFrm()using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Text
13、;using System.Windows.Forms;namespace 郵局訂報 public partial class admin : Form public admin() InitializeComponent(); private void button1_Click(object sender, EventArgs e) string username = textBox1.Text; string password = textBox2.Text; SqlConnection sqlCon = new SqlConnection(); SqlCommand LogInComm
14、and = new SqlCommand(); SqlDataAdapter userAdapter = new SqlDataAdapter(); DataSet dt = new DataSet(); sqlCon.ConnectionString = Data Source=.;Initial Catalog=newspaper;Integrated Security=True; LogInCommand.Connection = sqlCon; LogInCommand.CommandText = SELECT username,password From user where use
15、rname= + username + and password= + password + ; userAdapter.SelectCommand = LogInCommand; userAdapter.SelectCommand.Connection = sqlCon; sqlCon.Open(); userAdapter.Fill(dt, UserInfo);/填充數(shù)據(jù)集 if (dt.Tables0.Rows.Count 0) MessageBox.Show( 登陸成功); this.Visible = false; Form1 fr = new Form1(1); fr.ShowDi
16、alog(); else MessageBox.Show( 失敗); private void admin_Load(object sender, EventArgs e) textBox1.Focus(); private void button2_Click(object sender, EventArgs e) this.Close(); private void button3_Click(object sender, EventArgs e) this.Visible = false; Form1 fr = new Form1(0); fr.ShowDialog(); private
17、 void label2_Click(object sender, EventArgs e) 1、 管理員登錄 圖4-1 登錄圖4-2 管理員界面2、已注冊用戶登錄圖4-3 普通用戶登錄點擊確定后即可進入用戶訂報界面。3、新用戶登錄圖4-4 新用戶登錄圖4-5 信息提示注冊個人信息的代碼:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.T
18、ext;using System.Windows.Forms;namespace 郵局訂報 public partial class yonghu : Form public yonghu() InitializeComponent(); private void button5_Click(object sender, EventArgs e) SqlConnection sqconn = new SqlConnection(Data Source=.;Initial Catalog=newspaper;Integrated Security=True); string sql = Stri
19、ng.Format(insert into customer_info(CAN,CAD,CAW,CAY) VALUES(0,1,2,3), textBox1.Text, textBox2.Text, textBox3.Text, Convert.ToUInt64(textBox4.Text); try sqconn.Open(); SqlCommand command = new SqlCommand(sql, sqconn); int count = command.ExecuteNonQuery(); if (count 0) MessageBox.Show(注冊成功, 注冊信息, Mes
20、sageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show(注冊失敗); catch (Exception ex) MessageBox.Show(ex.Message, 操作數(shù)據(jù)庫錯誤!, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); finally sqconn.Close(); 確定后即進入訂報界面。4.3 用戶訂購報紙功能的實現(xiàn)選好報紙后,輸入要訂購的份數(shù),點擊訂購,即完成報紙的訂購。圖4-7 用戶界面using System;using System.
21、Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Text;using System.Windows.Forms;namespace 郵局訂報 public partial class dinggou : Form public dinggou() InitializeComponent(); private void dinggou_Load(object sender, EventArg
22、s e) SqlConnection sqconn = new SqlConnection(Data Source=.;Initial Catalog=newspaper;Integrated Security=True;); string stri = select distinct PNA from news_info ; try sqconn.Open(); SqlDataAdapter sdat = new SqlDataAdapter(stri, sqconn); DataSet Dset = new DataSet(); sdat.Fill(Dset); boBox1.DataSo
23、urce = Dset.Tables0; catch (Exception ex) MessageBox.Show(ex.Message, 操作數(shù)據(jù)庫錯誤!, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); finally sqconn.Close(); private void button6_Click(object sender, EventArgs e) int mon = 0, num = 0; SqlConnection sqconn = new SqlConnection(Data Source=.;Initial Catal
24、og=newspaper;Integrated Security=True;); string stri = String.Format(select PPR,PNUM from news_info where PNA=0, comboBox1.Text); / string stri_i = String.Format(select CAD,CAW from customer_info where CAN=0, comboBox2.Text); SqlCommand com; try sqconn.Open(); com = new SqlCommand(stri, sqconn); Sql
25、DataReader re = com.ExecuteReader(); re.Read(); mon=Convert.ToInt32(re0); num = Convert.ToInt32(re1); catch (Exception ex) MessageBox.Show(ex.Message, 操作數(shù)據(jù)庫錯誤!, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); finally sqconn.Close(); if (num = Convert.ToInt32(textBox2.Text) int money = mon * Conve
26、rt.ToInt32(textBox2.Text); stri = String.Format(insert into sub_news() VALUES(0,1,2), comboBox1.Text, textBox2.Text, Convert.ToInt32(textBox1.Text); string stru = update news_info set NUM= + (num - Convert.ToInt32(textBox2.Text); try sqconn.Open(); com = new SqlCommand(stri, sqconn); int count = com
27、.ExecuteNonQuery(); com = new SqlCommand(stru, sqconn); int co = com.ExecuteNonQuery(); if (count 0 & co 0) MessageBox.Show(訂報成功, 訂閱報紙, MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show(訂報失敗); catch (Exception ex) MessageBox.Show(ex.Message, 操作數(shù)據(jù)庫錯誤!, MessageBoxButtons.OK, Mess
28、ageBoxIcon.Exclamation); finally sqconn.Close(); else MessageBox.Show(報紙剩余數(shù)量不足!); 用戶查看自己已訂閱報紙的功能的實現(xiàn)圖4-10 用戶查看4.5 用戶退訂報紙功能的實現(xiàn)用戶在已訂閱欄里可選擇想要退訂的報紙,然后點擊退訂按鈕即可實現(xiàn)報紙的退訂。圖4-11 已定報紙using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using Sys
29、tem.Drawing;using System.Text;using System.Windows.Forms;namespace 郵局訂報 public partial class state : Form public state() InitializeComponent(); / private void state_Load(object sender, EventArgs e) / / this.button2.Visible = false; / private void button1_Click(object sender, EventArgs e) SqlConnecti
30、on sqconn = new SqlConnection(Data Source=.;Initial Catalog=newspaper;Integrated Security=True); string stri = String.Format(select PNO 報紙編號,CAN 客戶姓名,NUM 報紙數(shù)量 from sub_news where CAN=0,textBox1.Text); try sqconn.Open(); SqlDataAdapter sdat = new SqlDataAdapter(stri, sqconn); DataSet Dset = new DataS
31、et(); sdat.Fill(Dset, sub_news); this.dataGridView1.DataSource = Dset.Tablessub_news; /if (this.dataGridView1.Rows.Count != 0) catch (Exception ex) MessageBox.Show(ex.Message, 操作數(shù)據(jù)庫錯誤!, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); finally sqconn.Close(); private void textBox1_TextChanged(objec
32、t sender, EventArgs e) 4.6 管理員查看報紙信息的實現(xiàn)圖4-12 管理員查看圖4-13 管理員查看4.8 管理員查看用戶訂閱信息的實現(xiàn)圖4-14 管理員查看using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Text;using System.Windows.Forms;namespace 郵局訂報 public pa
33、rtial class tongji : Form public tongji() InitializeComponent(); private void tongji_Load(object sender, EventArgs e) SqlConnection sqconn = new SqlConnection(Data Source=.;Initial Catalog=newspaper;Integrated Security=True); string stri = select distinct PNA from news_info ; try sqconn.Open(); SqlD
34、ataAdapter sdat = new SqlDataAdapter(stri, sqconn); DataSet Dset = new DataSet(); sdat.Fill(Dset); boBox1.DataSource = Dset.Tables0; catch (Exception ex) MessageBox.Show(ex.Message, 操作數(shù)據(jù)庫錯誤!, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); finally sqconn.Close(); private void button1_Click(object
35、 sender, EventArgs e) string name = comboBox1.Text; SqlConnection sqconn = new SqlConnection(Data Source=.;Initial Catalog=newspaper;Integrated Security=True); string stri = String.Format(select news_info.PNA 報紙名稱,sum(.sub_news.NUM) 總定數(shù)量 from sub_news,news_info where news_info.PNA = sub_news.PNO and
36、 news_info.PNA=0group by PNA, name); try sqconn.Open(); SqlDataAdapter sdat = new SqlDataAdapter(stri, sqconn); DataSet Dset = new DataSet(); sdat.Fill(Dset, newspaper); this.dataGridView1.DataSource = Dset.Tablesnewspaper; catch (Exception ex) MessageBox.Show(ex.Message, 操作數(shù)據(jù)庫錯誤!, MessageBoxButtons
37、.OK, MessageBoxIcon.Exclamation); finally sqconn.Close(); private void button2_Click(object sender, EventArgs e) SqlConnection sqconn = new SqlConnection(Data Source=.;Initial Catalog=newspaper;Integrated Security=True); string stri = String.Format(select customer_info.CAN 客戶姓名,sum(sub_news.NUM) 總定數(shù)
38、量 from customer_info,sub_news where sub_news.CAN = customer_info.CAN and customer_info.CAN=0 group by customer_info.CAN , textBox1.Text); try sqconn.Open(); SqlDataAdapter sdat = new SqlDataAdapter(stri, sqconn); DataSet Dset = new DataSet(); sdat.Fill(Dset, newspaper); this.dataGridView1.DataSource
39、 = Dset.Tablesnewspaper; catch (Exception ex) MessageBox.Show(ex.Message, 操作數(shù)據(jù)庫錯誤!, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); finally sqconn.Close(); int sum = 0; int money = 0; for (intowCount; i+) sum += Convert.ToInt32( dataGridView1.Rowsi.Cells1.Value); 4.9 用戶查詢報紙功能的實現(xiàn)(1)客戶訂報情況圖4-16 客戶訂
40、報using System;using System.Collections.Generic;usingmponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Text;using System.Windows.Forms;namespace 郵局訂報 public partial class state : Form public state() InitializeComponent(); / private void state_Load(object sen
41、der, EventArgs e) / / this.button2.Visible = false; / private void button1_Click(object sender, EventArgs e) SqlConnection sqconn = new SqlConnection(Data Source=.;Initial Catalog=newspaper;Integrated Security=True); string stri = String.Format(select PNO 報紙編號,CAN 客戶姓名,LEI 報紙類型,NUM 報紙數(shù)量 from sub_news
溫馨提示
- 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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 醫(yī)療技術發(fā)展對教育政策的影響分析
- 全球教育技術發(fā)展現(xiàn)狀與未來趨勢分析
- 教育技術助力教師應對教學挑戰(zhàn)
- 商業(yè)教育中的數(shù)據(jù)隱私保護實踐
- 創(chuàng)新引領未來中醫(yī)教育的變革之路
- 抖音商戶直播樣品質(zhì)量抽檢制度
- 質(zhì)量培訓課件事例
- 八大城市物流企業(yè)物流園區(qū)綠色物流解決方案研究報告
- 公交優(yōu)先政策在2025年城市交通擁堵治理中的優(yōu)化策略研究報告
- BI-1206-生命科學試劑-MCE
- 貴州省政務信息化項目需求報告(建設類模板)、信息化建設項目實施方案模板2026年版(新建、升級改造)
- 2025年昆明市事業(yè)單位招聘考試綜合類專業(yè)能力測試試卷(文秘類)真題解析
- 2025至2030中國特醫(yī)食品行業(yè)發(fā)展趨勢分析與未來投資戰(zhàn)略咨詢研究報告
- 水利水電工程行業(yè)市場發(fā)展分析及發(fā)展前景與投資研究報告2025-2028版
- 血小板減少癥護理查房
- 浙江杭州市2024-2025學年高一下學期6月期末考試數(shù)學試題及答案
- 煤磨安全試題及答案
- 2025年中國郵政集團有限公司廣東省分公司人員招聘筆試備考試題及參考答案詳解1套
- 2025-2030中國全麥粉市場銷售狀況與競爭前景分析報告
- 主語從句超全課件
- 跟骨骨折經(jīng)皮復位與置釘知識2025
評論
0/150
提交評論