版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、實(shí)驗(yàn)報(bào)告?zhèn)}庫管理系統(tǒng)實(shí)驗(yàn)課程數(shù)據(jù)庫實(shí)驗(yàn)實(shí)驗(yàn)者1姓名班級學(xué)號實(shí)驗(yàn)者2姓名班級學(xué)號實(shí)驗(yàn)時(shí)間指導(dǎo)老師目錄P3 要求 P4 參考資料閱讀心得P6概述(設(shè)計(jì)思路、實(shí)現(xiàn)功能、運(yùn)用技術(shù))P7 實(shí)現(xiàn)及操作(關(guān)鍵代碼解析、運(yùn)行結(jié)果、類方法的介紹)P17存在問題和需要改善的地方P18附錄(完整代碼 包括 分布調(diào)試代碼)要求:使用ACCESS、SQL SERVER、ORACLE、MYSQL等作后臺(tái)數(shù)據(jù)庫,選擇ASP、VB、VC、JAVA等作為前臺(tái)開發(fā)工具設(shè)計(jì)一個(gè)小型管理系統(tǒng)。所設(shè)計(jì)的小型管理系統(tǒng)應(yīng)包含輸入輸出、查詢、插入、刪除等基本功能,功能越強(qiáng)大越好。根據(jù)題目的基本需求,設(shè)計(jì)數(shù)據(jù)庫、編寫程序,并寫出詳細(xì)的設(shè)計(jì)說明
2、書。每班以2人為一組自由分組,由班長將分組情況報(bào)到指導(dǎo)教師處;需要提交的文檔資料:設(shè)計(jì)說明書每人一份(包括:參考資料的閱讀心得,功能需求說明,設(shè)計(jì)思路,數(shù)據(jù)表結(jié)構(gòu)及作用,數(shù)據(jù)關(guān)系圖,存儲(chǔ)過程代碼及相關(guān)注釋,設(shè)計(jì)體會(huì));電子文檔:可運(yùn)行的,能實(shí)現(xiàn)全部或者主要基本功能的小型系統(tǒng)。課程設(shè)計(jì)說明書編寫規(guī)范 : a. 需求分析:題目要求達(dá)到的功能,所提供的原始數(shù)據(jù),需要輸出的數(shù)據(jù)及樣式等。b. 數(shù)據(jù)庫設(shè)計(jì):根據(jù)要求設(shè)計(jì)數(shù)據(jù)庫的結(jié)構(gòu),包括:表、數(shù)據(jù)完整性、關(guān)系、視圖。c. 開發(fā)方案選擇:主要是前端開發(fā)平臺(tái)的選擇與方案的比較,至少比較兩套方案。d. 安全性設(shè)計(jì):登錄用戶、數(shù)據(jù)庫用戶、數(shù)據(jù)庫角色、命令許可等方
3、面。e. 前臺(tái)應(yīng)用程序設(shè)計(jì):要求至少完成通過前臺(tái)程序?qū)崿F(xiàn)對后臺(tái)數(shù)據(jù)庫的數(shù)據(jù)查詢、插入、刪除與更新。涉及到數(shù)據(jù)的所有操作要求采用存儲(chǔ)過程的方式進(jìn)行。f. 附錄或參考資料:參考資料來源,閱讀心得。參考資料閱讀心得:參考資料(老師提供):2、 教材信息數(shù)據(jù)庫高校的教材管理需要相應(yīng)的數(shù)據(jù)庫環(huán)境,請根據(jù)如下系統(tǒng)需求定義數(shù)據(jù)表結(jié)構(gòu)及關(guān)系,并通過編寫存儲(chǔ)過程來實(shí)現(xiàn)其中的兩項(xiàng)功能:1)、教材出入庫(1)教材入庫將教材內(nèi)部識(shí)別號、入庫時(shí)間,入庫數(shù),適用對象等信息輸入到教材入庫記錄表中,并更新在庫教材信息表。教材入庫后把教材征訂單相應(yīng)項(xiàng)目做教材收到標(biāo)記。(暫不處理訂單中某教材只入庫其中一部分的情況,即缺貨情況。)
4、(2)教材出庫教師或?qū)W生或班級或其它人員領(lǐng)用教材,需要把教材內(nèi)部編號,教材代號,出庫時(shí)間,出庫數(shù)量,使用單位(指班級或教師,可多個(gè)班級或教師),用途,經(jīng)辦人等信息輸入到教材出庫記錄表中。并同時(shí)更新教材信息表中的在庫數(shù)量。為便于教材信息的錄入,可通過班級名稱、課程名稱或教材名稱查詢到要出庫的教材信息表中相應(yīng)教材的內(nèi)部編號。(3)教材信息錄入將教材的內(nèi)部識(shí)別號(由本系統(tǒng)自動(dòng)維護(hù)),代號,書名,編著者,出版社,版次,定價(jià),入庫時(shí)間,入庫數(shù),適用對象等信息錄入到系統(tǒng)的數(shù)據(jù)庫中。2)、教材查詢(1)在庫教材查詢查詢教材在庫情況:可按書名、代號等查詢, 可查詢某班級使用的教材及在庫數(shù)量,可查詢某課程使用的
5、教材及在庫數(shù)量。可查詢指定教材的在庫數(shù)量,價(jià)值總額??刹樵兘滩脑趲斓慕y(tǒng)計(jì)信息:在庫教材總數(shù)、種類總數(shù)、價(jià)值總額。(2)教材出庫查詢教材出庫信息查詢:按教材代號等信息查詢教材出庫情況,可查詢某使用對象(包括班級、教師、部門、其他人員)的教材出庫情況??刹樵兡硶r(shí)間范圍內(nèi)(學(xué)期、學(xué)年等)的教材出庫情況。(3)教材歷史查詢查詢指定書的在庫及出入庫的歷史信息,也可按時(shí)間或時(shí)間范圍查詢教材入庫情況。便于管理員掌握教材出入庫情況。3)、教材訂購(1)、生成教材訂單根據(jù)輸入的各專業(yè)班級課程教材選用信息、教材出版社信息生成訂單。(2)、教材訂單狀態(tài)管理訂單狀態(tài)管理:可標(biāo)記各訂單為有效(款項(xiàng)發(fā)出),圖書入庫后標(biāo)記
6、訂單為到貨,圖書退回標(biāo)記為退換貨。4)、教材訂單查詢可查詢指定學(xué)期教材訂單的到貨、缺貨情況,查詢訂單未到教材的訂貨公司信息包括它的銀行帳號、地址、聯(lián)系人、聯(lián)系方法等,以便與其聯(lián)系。5)、其他相關(guān)數(shù)據(jù):學(xué)生相關(guān)、課程相關(guān)、教師相關(guān)、班級相關(guān)、系部相關(guān)閱讀心得:我們的選題是倉庫管理系統(tǒng),和教材信息數(shù)據(jù)庫大致相同,實(shí)現(xiàn)的功能略作添加;我們需要完成的任務(wù):(1).這個(gè)實(shí)驗(yàn)本質(zhì)就是設(shè)置合理的操作界面,實(shí)現(xiàn)對數(shù)據(jù)庫的數(shù)據(jù)讀取、修改、刪除、更新等操作;(2). 系統(tǒng)的完備性和操作的安全性,是完善軟件的關(guān)鍵,其中包括:插入相同信息 ;數(shù)據(jù)庫中物品數(shù)量不足 ;管理員編號不存在 ;安全登錄 ;不同角色的對數(shù)據(jù)庫的
7、操作權(quán)限 ;等等問題,都是我們需要解決的基本問題;(3) 界面的美化和操作的快捷性和正確性 ;界面是給客戶的第一感觸,盡量的新穎并且符合客戶要求 :(這里我們是學(xué)習(xí),爭取掌握多一點(diǎn)處理界面的函數(shù),沒有系統(tǒng)的規(guī)劃) 如果美化界面是盡量的完善,那么操作的快捷性和正確性是必須要實(shí)現(xiàn)的,給客戶一個(gè)合理的操作是成功的必備條件;(4) 分工與合作我們兩個(gè)人都是java的初級學(xué)習(xí)者,不斷的學(xué)習(xí),分別設(shè)計(jì)不同的界面,相互交流實(shí)現(xiàn)效果的的經(jīng)驗(yàn);關(guān)于數(shù)據(jù)庫的知識(shí)和SQL語言的學(xué)習(xí),都是我們要重新學(xué)習(xí)的;(5) 文檔的處理和制作,也是我們要完成的重要任務(wù),我們也是分工完成;概述1.設(shè)計(jì)思路:(1)倉庫管理系統(tǒng),實(shí)現(xiàn)
8、功能:入庫登記 : 商品入庫記錄;出庫登記 : 庫存商品出庫;在庫商品查詢 : 庫存物品查詢;出庫入庫信息查詢 : 按時(shí)間,操作管理員查詢操作信息;管理員信息管理 : 管理員的登記,查詢,刪除;(2).附加實(shí)現(xiàn)功能:登錄界面 : 實(shí)現(xiàn)管理員員和客戶的不同角色登錄;界面的轉(zhuǎn)換 : 分別創(chuàng)建不同的窗口,并及時(shí)刪除瀏覽過的窗口;分角色設(shè)定使用權(quán)限: 管理員和客戶的使用權(quán)限不同;(3).異常處理:操作錯(cuò)誤 : 信息輸入錯(cuò)誤等;常規(guī)錯(cuò)誤 : 倉庫物品數(shù)量不足等;2.運(yùn)用技術(shù):(1) 界面實(shí)現(xiàn) : java語言;(2) 數(shù)據(jù)路操作實(shí)現(xiàn) :使用Access2003,運(yùn)用SQL語言進(jìn)行操作;實(shí)現(xiàn)及操作根據(jù)分析
9、,一共設(shè)計(jì)9個(gè)類,如下圖,其中:數(shù)據(jù)庫操作類:DBAccess :實(shí)現(xiàn)連接,查詢修改等分步操作 ;GetDBInfo :實(shí)現(xiàn)查詢結(jié)果集的返回 ;操作界面類:Enter :登錄界面Select : 功能選擇界面InStoreHouse : 物品入庫操作界面OutStoreHouse : 物品出庫操作界面SearchGoods : 物品查詢界面OutIn :出入庫查詢界面ManagerInfo : 管理員信息管理界面分步實(shí)現(xiàn)說明:1. DBAccess類public Statement getStatement(String dbPath) throws Exception:返回連接數(shù)據(jù)庫的狀態(tài)
10、;public ResultSet executeQuery(Statement stmt,String query) throws Exception :返回查詢結(jié)果集;public void executeUpdate(Statement stmt,String query) throws SQLException :更新數(shù)據(jù)庫 ;public void close() throws SQLException :關(guān)閉數(shù)據(jù)庫的連接 ;2. GetDBInfo類private Vector<Vector<String>> rows ; 記錄查詢返回元組private V
11、ector columnHeads ; 記錄查詢返回結(jié)果的標(biāo)題 /獲取表頭VolumnHeadspublic Vector getColumnHeads() ;/獲取表中內(nèi)容public Vector getRows() ;/ 更新數(shù)據(jù)庫 public void executeUpdate(Statement stmt,String query) throws SQLException ; 3. Enter類private JFrame frame ;private JButton enterButton ;private JButton resetButton;用于標(biāo)識(shí)登陸角色的單選按鈕pr
12、ivate JRadioButton radioButton1 ;private JRadioButton radioButton2 ;private JTextField nameText ;private JPasswordField passwordText ;表示登錄身份:public static boolean isManager = false ;實(shí)現(xiàn)效果:基本實(shí)現(xiàn):(1)圖片載入:JLabel label4 = new JLabel();ImageIcon icon = new ImageIcon("E:studyjavaworkspaceStoreHouseabc.
13、jpg");label4.setIcon(icon);(2)單選按鈕:ButtonGroup group = new ButtonGroup();radioButton1 = new JRadioButton("管理員",false);radioButton2 = new JRadioButton("客戶",true);group.add(radioButton1) ;group.add(radioButton2) ;4. InStoreHouse類基本成員變量:private JFrame frame ;輸入信息的11個(gè)文本框:private
14、 JTextField text1 - 11;private JTextField infoText ;private JButton okButton ;private JButton backButton ;設(shè)置日期格式:private static final String YYYMMDDHHMMSS = "yyyy/MM/dd HH:mm:ss"基本函數(shù):/SQL語句生成public String getSQL()/自動(dòng)生成插入時(shí)間 public String insertTime()/自動(dòng)生成入庫IDpublic String inHouseID()/清除文本框p
15、ublic void clear()實(shí)現(xiàn)效果:基本功能實(shí)現(xiàn):監(jiān)聽器的設(shè)定:public void actionPerformed(ActionEvent e) Object source = e.getSource() ; if(source = okButton) try DBAccess db=new DBAccess(); String dbPath="E:studyjavaworkspaceStoreHouseStoreHouse.mdb" Statement stmt=db.getStatement(dbPath); String query = getSQL()
16、; db.executeUpdate(stmt,query) ; query = insertSQL() ; db.executeUpdate(stmt,query) ; stmt.close(); db.close() ; infoText.setText("存儲(chǔ)成功"); clear() ; catch (Exception ex) ex.printStackTrace() ; else if(source = backButton) frame.dispose() ; new Select() ; 5. OutStoreHouse類基本成員變量:private JFr
17、ame frame ;private JButton okButton ;private JButton backButton ;private JTextField text1;private JTextField text2;private JTextField text3;private JTextField text4;private static final String YYYMMDDHHMMSS = "yyyy/MM/dd HH:mm:ss"private Integer num ; /修改數(shù)據(jù)里中數(shù)量的臨時(shí)變量基本函數(shù):同InStoreHouse雷同實(shí)現(xiàn)效果
18、:基本功能實(shí)現(xiàn):處理物品編號不存在,以及數(shù)量不足的問題:public void actionPerformed(ActionEvent e)Object source = e.getSource() ;if(source = okButton)tryDBAccess db=new DBAccess(); String dbPath="E:studyjavaworkspaceStoreHouseStoreHouse.mdb" String query=getGoodsSQL(); Statement stmt=db.getStatement(dbPath); ResultSe
19、t rs=db.executeQuery(stmt, query); if(!(rs.next()/判斷數(shù)據(jù)庫中是否有內(nèi)容JOptionPane.showMessageDialog(null, "輸入貨物編號不存在", "提示信息",JOptionPane.INFORMATION_MESSAGE);text3.setText("操作失敗");clear() ;else/判斷倉庫物品是否夠/這里實(shí)驗(yàn)了很多次 為什么 只有num = 放在這里才可以呢if(num = Integer.valueOf(rs.getString(1).intV
20、alue() - Integer.valueOf(text2.getText().intValue() < 0)JOptionPane.showMessageDialog(null, "倉庫貨物不足", "提示信息",JOptionPane.INFORMATION_MESSAGE);clear() ;text3.setText("操作失敗");elsequery = getSendOutSQL() ;db.executeUpdate(stmt, query) ;query = updateGoodsSQL(num) ;db.ex
21、ecuteUpdate(stmt, query) ;text3.setText("操作成功"); stmt.close() ; db.close() ; catch (Exception ex) ex.printStackTrace() ; else if(source = backButton)frame.dispose() ;new Select() ;解析:這里應(yīng)用到數(shù)據(jù)類型的轉(zhuǎn)變,String 到int double的轉(zhuǎn)化;還可以應(yīng)用其他方法:如: rs.getInt(3); 直接讀取數(shù)據(jù)庫中的 int類型; rs.getDouble(4) :直接讀取double類
22、型6. SearchGoods類基本成員函數(shù):private JFrame frame ;private JScrollPane jsp ;private JComboBox nameList ;private JComboBox typeList ;private JComboBox productList ;private JTextField countText ;private JTextField valueText ;private JButton okButton ;private JTable table ;private DefaultTableModel model ;pr
23、ivate JButton backButton ;private Vector rows; /表行值private Vector columnHeads;/ 表列名/查詢使用 :String str1,str2,str3 ;基本函數(shù)實(shí)現(xiàn)相同;實(shí)現(xiàn)效果:7. OutIn類基本函數(shù)變量:private JFrame frame ;private JRadioButton inButton ;private JRadioButton outButton;private JButton okButton ;private JButton backButton ;private JComboBox c
24、ombox1 ;private JComboBox combox2 ;private JTable table ;private Vector rows; /表行值private Vector columnHeads;/ 表列名private DefaultTableModel model ;private JScrollPane jsp ;privateString str1 = null ,str2 = null ; /查詢使用private boolean flag = false ;private int tmp = 0 ;private static final String YYY
25、MMDDHHMMSS = "yyyy/MM/dd"實(shí)現(xiàn)效果:基本實(shí)現(xiàn):時(shí)間字符創(chuàng)的分割處理 ;8. Select類基本成員變量private JButton button1 ;private JButton button2 ;private JButton button3 ;private JButton button4;private JButton button5 ;private JButton button6 ;private JTextField Text ;private JFrame frame ;實(shí)現(xiàn)效果:基本實(shí)現(xiàn):界面效果實(shí)現(xiàn):infoLabel.setH
26、orizontalAlignment(SwingConstants.CENTER); infoLabel.setBackground(Color.gray) ;Text.setBackground(Color.gray) ;Text.setForeground(Color.cyan) ;Text.setFont(new Font("宋體",Font.HANGING_BASELINE,20);9. ManagerInfo 類 基本函數(shù):private JFrame frame ;private JTabbedPane tabbedPane ;private JLabel la
27、bel1 ;private JLabel label2 ;private JLabel label3 ;private JPanel panel1 ;private JPanel panel2 ;private JPanel panel3 ;private JComboBox ageBox ;private JComboBox workAgeBox ;private JComboBox postionBox ;private JTextField text21 ;private JTextField text22 ;private JTextField text23 ;private JTex
28、tField text24 ;private JTextField text25 ;private JTextField text26 ;private JTextField text27 ;private JTextField text28 ;private JTextField text31 ;private JTextField text32 ;private JButton button11 ;private JButton button12 ;private JButton button21 ;private JButton button31 ;private JButton bac
29、kButton ;private JTable table ;private Vector rows; /表行值private Vector columnHeads;/ 表列名private DefaultTableModel model ;private JScrollPane jsp ;privateString str1= null,str2 = null ,str3 = null ; /查詢使用基本功能函數(shù):這里的函數(shù)處理和上面的相同,只是在布局上采用了JtablePanle面板,將三個(gè)功能加在同一個(gè)窗口里;實(shí)現(xiàn)效果:處理問題:要?jiǎng)h除的管理員信息不存在:if(source = butt
30、on31)boolean deleteState = false ;try DBAccess db=new DBAccess(); String dbPath="E:studyjavaworkspaceStoreHouseStoreHouse.mdb" String query = "select * from Manager where 編號 = " + "'" + text31.getText() + "'" Statement stmt=db.getStatement(dbPath); Res
31、ultSet rs=db.executeQuery(stmt, query); while(rs.next() if(rs.getString(1).equals(text31.getText() query = "delete from Manager where 編號 = " + "'" + text31.getText() + "'" db.executeUpdate(stmt,query) ;text31.setText("");text32.setText("刪除成功"
32、); deleteState = true ; stmt.close(); db.close() ; catch (Exception ex) ex.printStackTrace() ; if(deleteState = false) text32.setText("輸入編號不存在"); text31.setText(""); 解析:在刪除之前,對數(shù)據(jù)庫進(jìn)行檢查,判斷 管理員編號 是否存在 ;存在問題和需要完善的問題附錄 : 代碼實(shí)現(xiàn)DBAccess.Java文件import java.sql.Connection;import java.sql.Dr
33、iverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;public class DBAccess public Connection conn=null; / 連接未加密的數(shù)據(jù)庫 public Statement getStatement(String dbPath) throws Exception Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String dburl = "jdbc
34、:odbc:driver= Microsoft Access Driver (*.mdb);" + "DBQ="+dbPath;/ 此為NO-DSN方式 / String dburl ="jdbc:odbc:odbcName"/此為ODBC連接方式 conn = DriverManager.getConnection(dburl); return conn.createStatement(); /連接加密的數(shù)據(jù)庫 public Statement getStatement(String dbPath,String password) throw
35、s Exception Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String dburl ="jdbc:odbc:driver=Microsoft Access Driver (*.mdb);" + "pwd="+password+"DBQ="+dbPath;/ 此為NO-DSN方式 / String dburl ="jdbc:odbc:odbcName"/此為ODBC連接方式 conn = DriverManager.getConnecti
36、on(dburl); return conn.createStatement(); /* 查詢數(shù)據(jù)庫 */ public ResultSet executeQuery(Statement stmt,String query) throws Exception ResultSet rs=stmt.executeQuery(query); return rs; /* * 更新數(shù)據(jù)庫 */ public void executeUpdate(Statement stmt,String query) throws SQLException stmt.executeUpdate(query); /* *
37、 關(guān)閉鏈接 */ public void close() throws SQLException if(conn!=null) conn.close(); public static void main(String args) throws Exception DBAccess db=new DBAccess(); String dbPath="E:studyjavaworkspaceStoreHouseStoreHouse.mdb" String query="select * from Manager" Statement stmt=db.getS
38、tatement(dbPath); ResultSet rs=db.executeQuery(stmt, query); while(rs.next() System.out.println(rs.getString(1) + "t" + rs.getString(2) + "t" + rs.getString(3) + "t" + rs.getString(4) + "t" + rs.getString(5) + rs.getString(6) + rs.getString(7); Enter.java文件imp
39、ort javax.swing.*;import java.awt.event.*;import java.awt.*;import java.sql.ResultSet;import java.sql.Statement;public class Enter implements ActionListenerprivate JFrame frame ;private JButton enterButton ;private JButton resetButton;private JRadioButton radioButton1 ;private JRadioButton radioButt
40、on2 ;private JTextField nameText ;private JPasswordField passwordText ;public static boolean isManager = false ;public Enter()frame = new JFrame("倉庫管理系統(tǒng)登錄界面");enterButton = new JButton("登錄");resetButton = new JButton("重置");JLabel label1 = new JLabel("用戶名 :");J
41、Label label2 = new JLabel("密 碼 :");JLabel label3 = new JLabel("登錄方式 :");JLabel label4 = new JLabel();JLabel label5 = new JLabel();JLabel label6 = new JLabel();JLabel label7 = new JLabel();ImageIcon icon = new ImageIcon("E:studyjavaworkspaceStoreHouseabc.jpg");label4.set
42、Icon(icon);label5.setText("華潤品牌");label7.setText("追求卓越");label6.setText("中心軟件,讓您選擇無悔的軟件,感謝支持 曉偉O(_)O制作");nameText = new JTextField();passwordText = new JPasswordField();/單選按鈕ButtonGroup group = new ButtonGroup();radioButton1 = new JRadioButton("管理員",false);rad
43、ioButton2 = new JRadioButton("客戶",true);group.add(radioButton1) ;group.add(radioButton2) ;/* * 字體等格式設(shè)置 */label1.setHorizontalAlignment(SwingConstants.CENTER); label2.setHorizontalAlignment(SwingConstants.CENTER);label3.setHorizontalAlignment(SwingConstants.CENTER);label5.setHorizontalAlign
44、ment(SwingConstants.CENTER) ;label6.setHorizontalAlignment(SwingConstants.CENTER) ;label1.setFont(new Font("宋體",Font.HANGING_BASELINE,30);label2.setFont(new Font("宋體",Font.HANGING_BASELINE,30);label5.setFont(new Font("華文行楷",Font.HANGING_BASELINE,40);label7.setFont(new F
45、ont("華文行楷",Font.HANGING_BASELINE,40);label5.setForeground(Color.red);label7.setForeground(Color.red);/* * 局部布局 */label4.setBounds(0,0,800,90);label5.setBounds(0,100,200,100);label7.setBounds(0,200,200,100);label6.setBounds(0,300,800,100) ;label1.setBounds(220,110,150,60);label2.setBounds(2
46、20,180,150,60);nameText.setBounds(400,120,200,40);passwordText.setBounds(400,190,200,40);label3.setBounds(200,250,150,40);radioButton1.setBounds(350,250,100,40);radioButton2.setBounds(350,300,100,40);enterButton.setBounds(460,270,150,40);resetButton.setBounds(620,270,150,40) ;/* * 增加監(jiān)聽器 */enterButto
47、n.addActionListener(this);resetButton.addActionListener(this);/* * 整體布局 */Container ctn = frame.getContentPane();ctn.setLayout(null);ctn.add(label1) ;ctn.add(label2) ;ctn.add(nameText) ;ctn.add(passwordText) ;ctn.add(label3) ;ctn.add(label4);ctn.add(label5);ctn.add(label6);ctn.add(label7);ctn.add(ra
48、dioButton1);ctn.add(radioButton2) ;ctn.add(enterButton) ;ctn.add(resetButton) ;frame.setVisible(true);frame.setBounds(400,200,800,400);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);public void actionPerformed(ActionEvent e)boolean tmp = false ;Object source = e.getSource();if(source = enterBu
49、tton)tryDBAccess db=new DBAccess(); String dbPath="E:studyjavaworkspaceStoreHouseStoreHouse.mdb" String query="select * from Host" Statement stmt=db.getStatement(dbPath); ResultSet rs=db.executeQuery(stmt, query); while(rs.next() if(nameText.getText().equals(rs.getString(1) &
50、& passwordText.getText().equals(rs.getString(2) tmp = true ; Select select = new Select(); this.dispose() ; break ; stmt.close() ; db.close() ; catch (Exception ex) ex.printStackTrace() ; if(tmp = false ) JOptionPane.showMessageDialog(null, "輸入密碼或用戶名錯(cuò)誤", "登錄信息",JOptionPane.IN
51、FORMATION_MESSAGE); nameText.setText(""); passwordText.setText("") ; else if(source = resetButton)nameText.setText("");passwordText.setText("") ;else if(source = radioButton1)isManager = true ;else if(source = radioButton2)isManager = false ;public void dispos
52、e()this.frame.dispose();public static boolean isManager()return isManager ;public static void main(String args)Enter test = new Enter();GetDBInfo.java 文件import java.sql.*;import java.util.Vector;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.ResultSetMetaData;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JO
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2026年職業(yè)倦怠綜合測試(職業(yè)倦怠預(yù)防)試題及答案
- 2026年口腔科(種植牙案例)試題及答案
- 2025年中職(旅游服務(wù)與管理)旅游市場實(shí)訓(xùn)綜合測試題及答案
- 2025年高職(會(huì)計(jì))成本會(huì)計(jì)實(shí)訓(xùn)階段測試題及答案
- 2025年高職(林業(yè)技術(shù))森林管護(hù)技術(shù)試題及答案
- 巴爾蒂斯介紹
- 養(yǎng)老院老人營養(yǎng)膳食制度
- 養(yǎng)老院老人生活?yuàn)蕵坊顒?dòng)組織人員激勵(lì)制度
- 養(yǎng)老院老人家庭溝通制度
- 養(yǎng)老院緊急情況處理制度
- DB32/T+5311-2025+港口與道路工程+固化土施工技術(shù)規(guī)范
- DB31T+1661-2025公共區(qū)域電子屏播控安全管理要求
- 醫(yī)療聯(lián)合體兒童保健服務(wù)模式創(chuàng)新
- 2026年書記員考試題庫附答案
- 中國高尿酸血癥與痛風(fēng)診療指南(2024更新版)課件
- 2025至2030中國專用車行業(yè)發(fā)展分析及投資前景與戰(zhàn)略規(guī)劃報(bào)告
- DB13∕T 6066.3-2025 國資數(shù)智化 第3部分:數(shù)據(jù)治理規(guī)范
- 2025年白山輔警招聘考試題庫及答案1套
- 特種設(shè)備外借協(xié)議書
- 三元股份財(cái)務(wù)風(fēng)險(xiǎn)控制研究
- DBJ-T 13-417-2023 工程泥漿技術(shù)標(biāo)準(zhǔn)
評論
0/150
提交評論