數(shù)據(jù)庫課程設(shè)計-教材的征訂與發(fā)放-說明書-xxx_第1頁
數(shù)據(jù)庫課程設(shè)計-教材的征訂與發(fā)放-說明書-xxx_第2頁
數(shù)據(jù)庫課程設(shè)計-教材的征訂與發(fā)放-說明書-xxx_第3頁
數(shù)據(jù)庫課程設(shè)計-教材的征訂與發(fā)放-說明書-xxx_第4頁
數(shù)據(jù)庫課程設(shè)計-教材的征訂與發(fā)放-說明書-xxx_第5頁
已閱讀5頁,還剩16頁未讀 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

中北大學(xué)課程設(shè)計說明書數(shù)據(jù)庫課程實驗周學(xué)生姓名:學(xué)號:學(xué)院:電子與計算機科學(xué)技術(shù)學(xué)院

專業(yè):計算機科學(xué)與技術(shù)題目:教材征訂與發(fā)放系統(tǒng)

——錄入系統(tǒng)指導(dǎo)教師:楊劍

2011年6月23日1系統(tǒng)設(shè)計1.1設(shè)計目標(biāo)本模塊主要進行信息的添加,包括管理員對教師信息的錄入和教師對相應(yīng)教材等的錄入,將信息寫入到數(shù)據(jù)庫中。1.2開發(fā)和運行環(huán)境選擇開發(fā)工具:前臺開發(fā)語言為Eclipse,后臺數(shù)據(jù)庫為SQLServer運行環(huán)境:windows2000及更高的操作系統(tǒng)數(shù)據(jù)庫設(shè)計2.1需求描述管理員對教材信息表進行操作,實現(xiàn)對表中數(shù)據(jù)的插入,同時教師可以對自己所教授的教材進行錄入,將其插入到教師教材表中。管理員可以添加教師信息,將其錄入到教師信息表中。數(shù)據(jù)庫概念設(shè)計教師教師教材訂購mn教師所需數(shù)量 教師號教師信息教師號教師信息教師姓名職稱性別密碼圖1教師信息教材信息教材信息教材編號教材名稱教材價格出版社庫存量圖2教材信息教師教師—教材教師號教材名稱圖3教師—教材數(shù)據(jù)庫邏輯設(shè)計表1 教師信息表字段名稱數(shù)據(jù)類型長度是否為空備注教師號文本10否主鍵教師姓名文本20否性別文本10否教師職稱文本20否密碼文本20否表2教材信息字段名稱數(shù)據(jù)類型長度是否為空備注教材編號文本10否主碼教材名稱文本20否教材價格浮點型否出版社文本20否作者文本30否表3教師—教材字段名稱數(shù)據(jù)類型長度是否為空備注教師號文本10否主鍵教材名稱文本10否3錄入系統(tǒng)詳細設(shè)計教師錄入所需教材信息界面及相關(guān)代碼publicclassT錄入教材extendsjavax.swing.JFrameimplementsActionListener{privateJLabel課程名;privateJLabel教師姓名;privateJButton返回;privateJButton確認;privateJTextField訂購數(shù)量域;privateJLabel教師號域;privateJLabel教師號;privateJLabel教師姓名域;privateJLabel訂購數(shù)量;privateJTextField教材名域;privateJLabel教材名;

/***Auto-generatedmainmethodtodisplaythisJFrame*/publicstaticvoidmain(String[]args){SwingUtilities.invokeLater(newRunnable(){publicvoidrun(){T錄入教材inst=newT錄入教材();inst.setLocationRelativeTo(null);inst.setVisible(true);}});}publicT錄入教材(){super("教師錄入教材");initGUI();}privatevoidinitGUI(){try{setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);getContentPane().setLayout(null);{教材名=newJLabel();getContentPane().add(教材名);教材名.setText("\u6559\u6750\u540d");教材名.setBounds(41,155,64,15);}{教材名域=newJTextField();getContentPane().add(教材名域);教材名域.setBounds(142,152,134,22);}{訂購數(shù)量=newJLabel();getContentPane().add(訂購數(shù)量);訂購數(shù)量.setText("\u8ba2\u8d2d\u6570\u91cf");訂購數(shù)量.setBounds(51,200,64,15);}{訂購數(shù)量域=newJTextField();getContentPane().add(訂購數(shù)量域);訂購數(shù)量域.setBounds(142,187,134,22);}{確認=newJButton();getContentPane().add(確認);確認.addActionListener(this);確認.setText("\u786e\u8ba4");確認.setBounds(36,265,69,22);}{返回=newJButton();getContentPane().add(返回);返回.addActionListener(this);返回.setText("\u8fd4\u56de");返回.setBounds(220,265,62,22);}{教師姓名=newJLabel();getContentPane().add(教師姓名);教師姓名.setText("\u6559\u5e08\u59d3\u540d");教師姓名.setBounds(41,112,64,15);}{教師姓名域=newJLabel();getContentPane().add(教師姓名域);教師姓名域.setBounds(147,109,104,30);教師姓名域.setText(登錄界面.name);}{教師號=newJLabel();getContentPane().add(教師號);教師號.setText("\u6559\u5e08\u53f7");教師號.setBounds(36,64,79,15);}{教師號域=newJLabel();getContentPane().add(教師號域);教師號域.setBounds(178,64,98,23);}pack();this.setSize(424,355);}catch(Exceptione){//addyourerrorhandlingcodeheree.printStackTrace();}}

@OverridepublicvoidactionPerformed(ActionEvente){//TODOAuto-generatedmethodstubConnectioncon;Statementsql;ResultSetrs;StringBname=教材名域.getText();Stringnumber=訂購數(shù)量域.getText();intnum=Integer.valueOf(number);if(e.getSource()==確認){try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");con=DriverManager.getConnection("jdbc:odbc:liu","","");sql=con.createStatement();rs=sql.executeQuery("select教師號from教師信息where教師姓名='"+登錄界面.name+"'");if(rs.next()){sql.executeUpdate("insertinto教師教材values('"+rs.getString(1)+"','"+Bname+"','"+num+"')");JOptionPane.showMessageDialog(this,"添加成功!","提示對話框",JOptionPane.WARNING_MESSAGE);}}catch(Exceptione1){//TODOAuto-generatedcatchblocke1.printStackTrace();}}elseif(e.getSource()==返回){new教師界面().setVisible(true);dispose();}}}publicclass添加教材extendsjavax.swing.JFrameimplementsActionListener{

{//SetLook&Feeltry{javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");}catch(Exceptione){e.printStackTrace();}}管理員添加教師所需教材的界面及相關(guān)代碼

privateJLabel輸入要添加的教材信息;privateJLabel作者;privateJLabel價格;privateJTextField價格域;privateJTextField購書量域;privateJLabel購書量;privateJButton返回;privateJButton確認;privateJTextField作者域;privateJTextField出版社域;privateJTextField教材名域;privateJLabel出版社;privateJLabel教材名;

/***Auto-generatedmainmethodtodisplaythisJFrame*/publicstaticvoidmain(String[]args){SwingUtilities.invokeLater(newRunnable(){publicvoidrun(){添加教材inst=new添加教材();inst.setLocationRelativeTo(null);inst.setVisible(true);}});}public添加教材(){super();initGUI();}privatevoidinitGUI(){try{setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);getContentPane().setLayout(null);{輸入要添加的教材信息=newJLabel();getContentPane().add(輸入要添加的教材信息);輸入要添加的教材信息.setText("\u8f93\u5165\u8981\u6dfb\u52a0\u7684\u6559\u6750\u4fe1\u606f");輸入要添加的教材信息.setBounds(77,23,261,27);輸入要添加的教材信息.setFont(newjava.awt.Font("楷體_GB2312",0,24));輸入要添加的教材信息.setForeground(newjava.awt.Color(255,0,0));}{教材名=newJLabel();getContentPane().add(教材名);教材名.setText("\u6559\u6750\u540d");教材名.setBounds(49,82,67,15);}{出版社=newJLabel();getContentPane().add(出版社);出版社.setText("\u51fa\u7248\u793e");出版社.setBounds(49,117,67,15);}{作者=newJLabel();getContentPane().add(作者);作者.setText("\u4f5c\u8005");作者.setBounds(49,152,67,15);}{價格=newJLabel();getContentPane().add(價格);價格.setText("\u4ef7\u683c");價格.setBounds(49,186,67,15);}{教材名域=newJTextField();getContentPane().add(教材名域);教材名域.setBounds(134,79,143,22);}{出版社域=newJTextField();getContentPane().add(出版社域);出版社域.setBounds(134,114,143,22);}{作者域=newJTextField();getContentPane().add(作者域);作者域.setBounds(134,149,143,22);}{價格域=newJTextField();getContentPane().add(價格域);價格域.setBounds(134,183,143,22);}{確認=newJButton();getContentPane().add(確認);確認.addActionListener(this);確認.setText("\u786e\u8ba4");確認.setBounds(42,272,67,28);}{返回=newJButton();getContentPane().add(返回);返回.addActionListener(this);返回.setText("\u8fd4\u56de");返回.setBounds(234,272,62,28);}{購書量=newJLabel();getContentPane().add(購書量);購書量.setText("\u8d2d\u4e66\u91cf");購書量.setBounds(49,218,60,15);}{購書量域=newJTextField();getContentPane().add(購書量域);購書量域.setBounds(134,215,143,21);}pack();this.setSize(428,374);}catch(Exceptione){//addyourerrorhandlingcodeheree.printStackTrace();}}

@OverridepublicvoidactionPerformed(ActionEvente){//TODOAuto-generatedmethodstubStringname=教材名.getText();Stringpress=出版社.getText();Stringauthor=作者.getText();Stringp=價格域.getText();floatprice=Float.parseFloat(p);Stringnumber=購書量域.getText();intnum=Integer.valueOf(number);if(e.getSource()==確認){Connectioncon;Statementsql;ResultSetrs;try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");con=DriverManager.getConnection("jdbc:odbc:liu","","");sql=con.createStatement();sql.executeUpdate("insertinto教材信息values('"+name+"'"+",'"+press+"','"+author+"','"+price+"','"+num+"')");JOptionPane.showMessageDialog(this,"添加成功!","提示對話框",JOptionPane.WARNING_MESSAGE);}catch(Exceptione1){//TODOAuto-generatedcatchblocke1.printStackTrace();}}elseif(e.getSource()==返回){new管理員界面().setVisible(true);dispose();}else{JOptionPane.showMessageDialog(this,"輸入信息錯誤!","提示對話框",JOptionPane.WARNING_MESSAGE);}}}管理員添加教師信息的界面及相關(guān)代碼publicclass添加教師信息extendsjavax.swing.JFrameimplementsActionListener{privateJLabel教師號;privateJLabel教師姓名;privateJLabel性別;privateJButton返回;privateJButton確認;privateJTextField職稱域;privateJPasswordField確認密碼域;privateJLabel確認密碼;privateJPasswordField密碼域;privateJTextField性別域;privateJTextField教師姓名域;privateJTextField教師號域;privateJLabel密碼;privateJLabel職稱;

/***Auto-generatedmainmethodtodisplaythisJFrame*/publicstaticvoidmain(String[]args){SwingUtilities.invokeLater(newRunnable(){publicvoidrun(){添加教師信息inst=new添加教師信息();inst.setLocationRelativeTo(null);inst.setVisible(true);}});}public添加教師信息(){super();initGUI();}privatevoidinitGUI(){try{setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);getContentPane().setLayout(null);{教師號=newJLabel();getContentPane().add(教師號);教師號.setText("\u6559\u5e08\u53f7");教師號.setBounds(50,46,67,21);}{教師姓名=newJLabel();getContentPane().add(教師姓名);教師姓名.setText("\u6559\u5e08\u59d3\u540d");教師姓名.setBounds(50,79,67,17);}{性別=newJLabel();getContentPane().add(性別);性別.setText("\u6027\u522b");性別.setBounds(50,113,67,17);}{職稱=newJLabel();getContentPane().add(職稱);職稱.setText("\u804c\u79f0");職稱.setBounds(50,146,67,17);}{密碼=newJLabel();getContentPane().add(密碼);密碼.setText("\u5bc6\u7801");密碼.setBounds(50,181,67,17);}{教師號域=newJTextField();getContentPane().add(教師號域);教師號域.setBounds(144,45,141,24);}{教師姓名域=newJTextField();getContentPane().add(教師姓名域);教師姓名域.setBounds(144,76,141,24);}{性別域=newJTextField();getContentPane().add(性別域);性別域.setBounds(144,110,141,24);}{職稱域=newJTextField();getContentPane().add(職稱域);職稱域.setBounds(144,143,141,24);}{確認=newJButton();getContentPane().add(確認);確認.setText("\u786e\u8ba4");確認.addActionListener(this);確認.setBounds(50,277,71,30);確認.setFont(newjava.awt.Font("微軟雅黑",0,16));}{返回=newJButton();getContentPane().add(返回);返回.addActionListener(this);返回.setText("\u8fd4\u56de");返回.setBounds(220,278,91,29);返回.setFont(newjava.awt.Font("微軟雅黑",0,14));}{密碼域=newJPasswordField();getContentPane().add(密碼域);密碼域.setBounds(144,181,141,22);}{確認密碼=newJLabel();getContentPane().add(確認密碼);確認密碼.setText("\u786e\u8ba4\u5bc6\u7801");確認密碼.setBounds(43,228,74,15);}{確認密碼域=newJPasswordField();getContentPane().add(確認密碼域);確認密碼域.setBounds(144,225,141,22);}pack();this.setSize(399,354);}catch(Exceptione){//addyourerrorhandlingcodeheree.printStackTrace();}}

@OverridepublicvoidactionPerformed(ActionEvente){//TODOAuto-generatedmethodstubStringno=教師號域.getText();Stringname=教師姓名域.getText();Stringsex=性別域.getText();Stringpro=職稱域.getText();Stringkey=密碼域.getText();Stringconfirm=確認密碼域.getText();if(e.getSource()==確認&&key.equals(confirm)&&key.isEmpty()==false){Connectioncon;State

溫馨提示

  • 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)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論