




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除學生學籍管理系統(tǒng)1 課程設(shè)計目的、設(shè)計內(nèi)容與需求分析1.1 課程設(shè)計目的通過本次課程設(shè)計的實踐操作,能夠讓學生懂得 Java、SQL 的各種相關(guān)知識的使用,真正的提高學生獨立開發(fā)設(shè)計 Java 程序,把課堂上的知識運用在實踐上,一門編程語言只有在不斷實踐操作和練習上才會有進步。1.2 軟件設(shè)計內(nèi)容學生學籍管理系統(tǒng),可用于學校等機構(gòu)的學生信息管理,查詢,更新與維護,使用方便,易用性強,圖形界面清晰明了。該軟件用 java 語言編寫,用SQLServer2005 數(shù)據(jù)庫作為后臺的數(shù)據(jù)庫進行信息的存儲,用 SQL 語句完成添加,查詢,修改,刪除的操作。用 OD
2、BC 驅(qū)動實現(xiàn)前臺 Java 與后臺 SQL 數(shù)據(jù)庫的連接。Java 語言跨平臺性強,可以在 windows,linux,ubuntu 等系統(tǒng)下使用,方便簡單,安全性好。SQLServer2005 數(shù)據(jù)庫高效安全,兩者結(jié)合可相互利用各自的優(yōu)勢。系統(tǒng)可供輸入的屬性有“學號”,“姓名”,“性別”,“班級”,“學院”,“籍貫”。該系統(tǒng)實現(xiàn)的大致功能:1管理員登陸界面。該界面可以輸入管理員號,登陸密碼。用戶通過驗證通過后方可進入管理系統(tǒng)。一定程度上保證了信息安全性,防止他人未經(jīng)允許篡改學生信息。2查詢學生信息??梢赃x擇由用戶選擇“顯示系統(tǒng)中當前的所有學生信息”。也可以精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除
3、 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除選擇按照“某一個學號查詢該學號的學生信息”。查詢到的信息會在窗口中依次顯示出來。3添加學生信息??梢园凑請D形的界面的顯示依次輸入新學生的“學號”,“姓名”,“性別”,“班級”,“學院”,“籍貫”。完成新紀錄的添加。4修改學生信息??梢赃x擇按照“學號”或者“姓名”找到該學生的學生信息并輸入要修改的屬性,并輸入新的數(shù)據(jù)。完成對學生記錄的修改。5刪除學生記錄。可以根據(jù)輸入的“學號”或者”姓名”進行刪除的操作。1.3 需求分析在一些學校等機構(gòu),隨著學生數(shù)量的不斷增加,學生的信息不斷增多,人工管理信息的難度也越來越大。而且效率也是很低的。所以如何自動高效地管理信息
4、是這些年來許多人所研究的。隨著這些年電腦計算機的速度質(zhì)的提高,成本的下降,IT 互聯(lián)網(wǎng)大眾趨勢的發(fā)展。我們使用電腦的高效率才處理數(shù)據(jù)信息成為可能。 學生學籍管理系統(tǒng)的出現(xiàn),正是管理人員與信息數(shù)據(jù),計算機的進入互動時代的體現(xiàn)。友好的人機交互模式,清晰簡明的圖形界面,高效安全的操作使得我們對成千上萬的信息的管理得心應(yīng)手。學生學籍管理系統(tǒng),以 SQL 數(shù)據(jù)庫作為后臺信息存儲,Java 作為前臺系統(tǒng)的語言。提供了對學生信息添加,查詢,修改,刪除的功能。實現(xiàn)了最基本的信息管理。2 設(shè)計思路與主功能設(shè)計精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 登錄管理系統(tǒng)精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有
5、侵權(quán)請聯(lián)系網(wǎng)站刪除顯示2.1.4功能模塊說明:1).管理員登陸界面。該界面可以輸入管理員號,登陸密碼。用戶通過驗證通過后方可進入管理系統(tǒng)。一定程度上保證了信息安全性,防止他人未經(jīng)允許篡改學生信息。2).查詢學生信息。可以選擇由用戶選擇“顯示系統(tǒng)中當前的所有學生信息”。也可以選擇按照“某一個學號查詢該學號的學生信息”。查詢到的信息會在窗口中依次顯示出來。3).添加學生信息??梢园凑請D形的界面的顯示依次輸入新學生的“學號”,“姓名”,“性別”,“班級”,“學院”,“籍貫”。完成新紀錄的添加。4).修改學生信息??梢赃x擇按照“學號”或者“姓名”找到該學生的學生信息并輸入要修改的屬性,并輸入新的數(shù)據(jù)。
6、完成對學生記錄的修改。5).刪除學生記錄??梢愿鶕?jù)輸入的“學號”或者”姓名”進行刪除的操作。6).顯示學生信息??梢燥@示所有學生的信息、以供查看。精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 管理系統(tǒng)精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 Login1. 當輸入了一個錯誤時,會出現(xiàn)下圖!精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 顯示精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 1、設(shè)置的學號為主鍵、所以若添加的學號已存在的、會彈出如下圖的提示:精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 2.如 果 輸 入
7、的 學 號 在 數(shù) 據(jù) 庫 中 可 以 查 詢 的 到 、 則 會 有 彈 出 下 面 的 菜 單 :精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 然后修改學生對應(yīng)框的學生信息、修改完成后、點擊精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 1.若輸入的學號不存在、會彈出如下提示:精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 3.2.6 退出,退出本學籍管理系統(tǒng)。課程設(shè)計是培養(yǎng)學生綜合運用所學知識,發(fā)現(xiàn),提出,分析和解決實際問題,鍛煉實踐能力的重要環(huán)節(jié),是對學生實際工作能力的具體訓練和考察過程. 本次課程設(shè)計雖然很辛精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除
8、苦,實在是受益匪淺。本來這門課的知識學的就不夠扎實,本次課程設(shè)計,在設(shè)計過程中碰到了很多問題,剛開始要設(shè)計的時候,還真不知道從哪里下手但最終在圖書、同學和老師的幫助下都得到了解決,讓我學會了好多書本上沒有的東西,通過本次課程設(shè)計我也能將課本上的知識融會貫通,起到了很好的輔助學習的效果,但是我發(fā)現(xiàn)我學到的知識比整整一個學期學到的都多。理論和實踐的相結(jié)合是學習最有效的方法。在設(shè)計的過程中發(fā)現(xiàn)了自己的不足之處,對以前所學過的知識理解得不夠深刻,掌握得不夠牢固,通過這次課程設(shè)計之后,一定把以前所學過的知識重新溫故。通過這次課程設(shè)計使我懂得了理論與實際相結(jié)合是很重要的,只有理論知識是遠遠不夠的,只有把所
9、學的理論知識與實踐相結(jié)合起來,從理論中得出結(jié)論,才能真正為社會服務(wù),從而提高自己的實際動手能力和獨立思考的能力。5、參考文獻:1.數(shù)據(jù)庫系統(tǒng)原理與應(yīng)用孟彩霞主編人民教育出版社2.JAVA 程序設(shè)計James Cohoon /Jack Davidson 著清華大學出版社李偉等著 電 子 工 業(yè)3.JAVA 項目開發(fā)案例整合出版社白偉明6、代碼:(一)登陸:Login精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除import java.awt.Dimension;import java.awt.Toolkit;import java.awt.event.ActionEv
10、ent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPasswordField;import javax.swing.JTextField;public class Login public static void main(String args) final String userName = 1;fin
11、al String passwrod = 1;final JFrame jFrame = new JFrame(登陸界面);Dimensiondimension=Toolkit.getDefaultToolkit().getScreenSize();jFrame.setBounds(int)dimension.getWidth() - 200) / 2,(int)dimension.getHeight() - 300) / 2, 200, 150);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除jFrame.setResizable(false);jFrame.se
12、tLayout(null);jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);JLabel label1 = new JLabel(姓名);label1.setBounds(10, 10, 100, 30);jFrame.add(label1);JLabel label2 = new JLabel(密碼);label2.setBounds(10, 40, 100, 30);jFrame.add(label2);final JTextField text1 = new JTextField();text1.setBounds(50, 15
13、, 130, 20);jFrame.add(text1);final JPasswordField text2 = new JPasswordField();text2.setBounds(50, 45, 130, 20);jFrame.add(text2);JButton button = new JButton(Login);button.setBounds(10, 75, 170, 40);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除button.addActionListener(new ActionListener() Overridepublic vo
14、id actionPerformed(ActionEvent e) if(userName.equals(text1.getText()&passwrod.equals(text2.getText() jFrame.dispose(); /使遠窗口消失JOptionPane.showMessageDialog(null, 登陸成功, 提示, JOptionPane.INFORMATION_MESSAGE);jFrame.dispose();(new Menu().go(); else JOptionPane.showMessageDialog(null, 錯誤, 提示, JOptionPane
15、.ERROR_MESSAGE);text1.setText();text2.setText(););jFrame.add(button);jFrame.setVisible(true);jFrame.setLocationRelativeTo(null);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除(二):主界面:Menuimport java.awt.Container;import java.awt.LayoutManager;import java.awt.event.ActionEvent;import java.awt.event.ActionListe
16、ner;importjava.awt.*;import javax.swing.JButton;import javax.swing.JFrame;importjava.awt.event.WindowAdapter;importjava.awt.event.WindowEvent;public class Menu JFrame jf;JButton j1,j2, j3, j4, j5,j6;public staticvoid main(Stringargs)精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除Menu m =newm.go();Menu();publi
17、c void go()jf=new JFrame(學生學籍管理系統(tǒng));jf.setBounds(200, 200, 300, 200);Containercp=jf.getContentPane();cp.setLayout(newFlowLayout(FlowLayout.LEADING,20,20);j1=new JButton(添加學生信息);j2=new JButton(修改學生信息);j3=new JButton(查詢學生信息);j4=new JButton(刪除學生信息);j5=new JButton(顯示學生信息);j6=new JButton(退出管理系統(tǒng));cp.add(j1
18、);cp.add(j2);cp.add(j3);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除cp.add(j4);cp.add(j5);cp.add(j6);j1.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)jf.dispose();/new Add(););j2.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)/jf.dispose();
19、Modify modify=new Modify(););j3.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)jf.dispose();/精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除Search search=new Search(););j4.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)/jf.dispose();Delete dele
20、te=new Delete(););j5.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)/jf.dispose();Display display=new Display(););j6.addActionListener(new ActionListener()/ActionListener 接收動作事件的監(jiān)聽器接口。在處理動作事件感興趣的類實現(xiàn)這個接口,這個類創(chuàng)建精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除的對象注冊一個組件,使用組件的 addAct
21、ionListener 方法。/動作事件發(fā)生時,該對象的 actionPerformed 方法被調(diào)用。public void actionPerformed(ActionEvent ae)System.exit(0););jf.setVisible(true);/jf.setLocationRelativeTo(null);/jf.setLocationRelativeTo(null)是用來使窗口顯示在屏幕正中間(三)、添加:Addimport java.awt.*;import javax.swing.*;精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除import
22、 java.awt.event.*;import java.sql.*;public class Add extends JFrame implements ActionListenerstatic Add s;/*添加學生信息控件*/JPanel jpl = new JPanel();JLabel label1 = new JLabel(添加學生信息,JLabel.CENTER);JLabel label2 = new JLabel(學號:,JLabel.CENTER);JLabel label3 = new JLabel(姓名:,JLabel.CENTER);JLabel label4 =
23、 new JLabel(性別:,JLabel.CENTER);JLabel label5 = new JLabel(班級:,JLabel.CENTER);JLabel label6 = new JLabel(生日:,JLabel.CENTER);JLabel label7 = new JLabel(政治面貌:,JLabel.CENTER);JLabel label8 = new JLabel(入學年份:,JLabel.CENTER);JLabel label9 = new JLabel(入學成績:,JLabel.CENTER);JLabel labelA = new JLabel(聯(lián)系方式:,
24、JLabel.CENTER);JLabel labelB = new JLabel(家庭住址:,JLabel.CENTER);/ JLabel labelC = new JLabel(備注信息:,JLabel.CENTER);JTextField Sno = new JTextField(2);JTextField Sname = new JTextField(4);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除JTextField Ssex = new JTextField();JTextField Sclas = new JTextField();JTextFi
25、eld Sbirth = new JTextField();JTextField Snation = new JTextField();JTextField Syear = new JTextField();JTextField Sgrade = new JTextField();JTextField Stel = new JTextField();JTextField Saddress = new JTextField();JButton reset = new JButton(重置);JButton addmsg = new JButton(添加);public Add()super(添加
26、學生信息);this.setResizable(false);this.setSize(500,600);this.setVisible(true);/this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.add(jpl);this.setLocationRelativeTo(null);jpl.setLayout(null);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除addmsg.addActionListener(this);reset.addActionListener(this);/*插入面板*
27、/label1.setBounds(100,20,300,20);jpl.add(label1);label2.setBounds(100,50,70,20);jpl.add(label2);Sno.setBounds(190,50,140,20);jpl.add(Sno);label3.setBounds(100,90,70,20);jpl.add(label3);Sname.setBounds(190,90,140,20);jpl.add(Sname);label4.setBounds(100,130,70,20);jpl.add(label4);Ssex.setBounds(190,13
28、0,140,20);jpl.add(Ssex);label5.setBounds(100,170,70,20);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除jpl.add(label5);Sclas.setBounds(190,170,140,20);jpl.add(Sclas);label6.setBounds(100,210,70,20);jpl.add(label6);Sbirth.setBounds(190,210,140,20);jpl.add(Sbirth);label7.setBounds(100,250,70,20);jpl.add(label7)
29、;Snation.setBounds(190,250,140,20);jpl.add(Snation);label8.setBounds(100,290,70,20);jpl.add(label8);Syear.setBounds(190,290,140,20);jpl.add(Syear);label9.setBounds(100,330,70,20);jpl.add(label9);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除Sgrade.setBounds(190,330,140,20);jpl.add(Sgrade);labelA.setBounds(10
30、0,370,70,20);jpl.add(labelA);Stel.setBounds(190,370,140,20);jpl.add(Stel);labelB.setBounds(100,410,70,20);jpl.add(labelB);Saddress.setBounds(190,410,140,20);jpl.add(Saddress);reset.setBounds(120,450,90,20);addmsg.setBounds(240,450,90,20);jpl.add(reset);jpl.add(addmsg);public void actionPerformed(Act
31、ionEvent e)精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除if(e.getSource()=addmsg)tryClass.forName(sun.jdbc.odbc.JdbcOdbcDriver);catch (ClassNotFoundException ce)JOptionPane.showMessageDialog(s,ce.getMessage();tryDriverManager.registerDriver(newcom.microsoft.sqlserver.jdbc.SQLServerDriver();Connectionconn=Dri
32、verManager.getConnection(jdbc:sqlserver:/localhost:1433;databasename=master,sa,123);Statement stmt=conn.createStatement();int a = stmt.executeUpdate(insert into精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除shujuku(Sno , Sname , Ssex , Sclas ,Sbirth , Snation , Syear ,Sgrade,Stel,Saddress)values(+Sno.getText(
33、)+,+Sname.getText()+,+Ssex.getText()+,+Sclas.getText()+, +Sbirth.getText()+,+Snation.getText()+,+Syear.getText()+, +Sgrade.getText()+,+Stel.getText()+,+Saddress.getText()+);System.out.println(a);if(a=1)JOptionPane.showMessageDialog(s, 已 成功添加, 提示, JOptionPane.INFORMATION_MESSAGE);elseJOptionPane.show
34、MessageDialog(s, 添 加失敗, 提示, JOptionPane.ERROR_MESSAGE);stmt.close();精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除catch (SQLException se)JOptionPane.showMessageDialog(s,se.getMessage();se.printStackTrace();elseSno.setText();Sname.setText();Ssex.setText();Sclas.setText();Sbirth.setText();Snation.setText();Sye
35、ar.setText();Sgrade.setText();Stel.setText();Saddress.setText();Sno.requestFocus();精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除public static void main(String args)Add amg = new Add();(四)、修改:Modifyimport javax.swing.*;import java.awt.*;import java.awt.event.*;import java.sql.*;public class Modify extends JF
36、rame implements ActionListenerConnection cnn;Statement stm;ResultSet rs;JLabel label2 = new JLabel(學號:,JLabel.CENTER);JLabel label3 = new JLabel(姓名:,JLabel.CENTER);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除JLabel label4 = new JLabel(性別:,JLabel.CENTER);JLabel label5 = new JLabel(班級:,JLabel.CENTER);JLabel
37、label6 = new JLabel(生日:,JLabel.CENTER);JLabel label7 = new JLabel(政治面貌:,JLabel.CENTER);JLabel label8 = new JLabel(入學年份:,JLabel.CENTER);JLabel label9 = new JLabel(入學成績:,JLabel.CENTER);JLabel labelA = new JLabel(聯(lián)系方式:,JLabel.CENTER);JLabel labelB = new JLabel(家庭住址:,JLabel.CENTER);JTextField Sno = new
38、JTextField(12);JTextField Sname = new JTextField(12);JTextField Ssex = new JTextField(12);JTextField Sclas = new JTextField(12);JTextField Sbirth = new JTextField(12);JTextField Snation = new JTextField(12);JTextField Syear = new JTextField(12);JTextField Sgrade = new JTextField(12);JTextField Stel
39、= new JTextField(12);JTextField Saddress = new JTextField(12);JButton btnModify=new JButton(修改);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除JButton btnCancel=new JButton(取消);JButton btnQuery=new JButton(查詢);JPanel pan=new JPanel();JPanel pan1=new JPanel();JPanel pan2=new JPanel();JPanel pan3=new JPanel();J
40、Panel pan4=new JPanel();JPanel pan5=new JPanel();JPanel pan6=new JPanel();JPanel pan7=new JPanel();JPanel pan8=new JPanel();JPanel pan9=new JPanel();JPanel pan10=new JPanel();JPanel pan11=new JPanel();Modify()super(修改學生信息);setSize(500,600);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除this.setLocationRelativ
41、eTo(null);setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);pan.setBorder(BorderFactory.createEtchedBorder();pan1.add(label2);pan1.add(Sno);pan2.add(label3);pan2.add(Sname);pan3.add(label4);pan3.add(Ssex);pan4.add(label5);pan4.add(Sclas);pan5.add(label6);pan5.add(Sbirth);pan6.add(label7);pan6.add(Sn
42、ation);pan7.add(label8);pan7.add(Syear);pan8.add(label9);pan8.add(Sgrade);pan9.add(labelA);pan9.add(Stel);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除pan10.add(labelB);pan10.add(Saddress);pan11.add(btnQuery);pan11.add(btnModify);pan11.add(btnCancel);pan.setLayout(new GridLayout(10,5);pan.add(pan1);pan.add(
43、pan2);pan.add(pan3);pan.add(pan4);pan.add(pan5);pan.add(pan6);pan.add(pan7);pan.add(pan8);pan.add(pan9);pan.add(pan10);getContentPane().add(pan,Center);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除getContentPane().add(pan11,South);btnQuery.addActionListener(this);btnModify.addActionListener(this);btnCancel.
44、addActionListener(this);btnModify.setEnabled(false);Sname.setEditable(false);Ssex.setEditable(false);Sclas.setEditable(false);Sbirth.setEditable(false);Snation.setEditable(false);Syear.setEditable(false);Sgrade.setEditable(false);Stel.setEditable(false);Saddress.setEditable(false);setVisible(true);S
45、no.requestFocus();public void actionPerformed(ActionEvent ae)String id = Sno.getText();精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除if(ae.getSource()=btnCancel)try if(stm!=null)stm.close();if(cnn!=null)cnn.close(); catch (SQLException ex) ex.printStackTrace();this.dispose(); else if(ae.getSource()=btnQuery)
46、tryClass.forName(sun.jdbc.odbc.JdbcOdbcDriver);DriverManager.registerDriver(newcom.microsoft.sqlserver.jdbc.SQLServerDriver();Connectioncnn=DriverManager.getConnection(jdbc:sqlserver:/localhost:1433;databasename=master,sa,123);Statement stmt=cnn.createStatement();rs=stmt.executeQuery(select * from s
47、hujukuwhere Sno=+id+);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除if(rs.next()btnModify.setEnabled(true);Sname.setEditable(true);Ssex.setEditable(true);Sclas.setEditable(true);Sbirth.setEditable(true);Snation.setEditable(true);Syear.setEditable(true);Sgrade.setEditable(true);Stel.setEditable(true);Saddress
48、.setEditable(true);Sno.setText(rs.getString(Sno);Sname.setText(rs.getString(Sname);Ssex.setText(rs.getString(Ssex);Sclas.setText(rs.getString(Sclas);Sbirth.setText(rs.getString(Sbirth);Snation.setText(rs.getString(Snation);Syear.setText(rs.getString(Syear);Sgrade.setText(rs.getString(Sgrade);Stel.se
49、tText(rs.getString(Stel);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除Saddress.setText(rs.getString(Saddress);elseJOptionPane.showMessageDialog(null, 不存在該記錄!, 提示, JOptionPane.ERROR_MESSAGE);btnModify.setEnabled(false);Sno.setText();Sname.setText();Ssex.setText();Sclas.setText();Sbirth.setText();Snation.setT
50、ext();Syear.setText();Sgrade.setText();Stel.setText();Saddress.setText();Sname.setEditable(false);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除Ssex.setEditable(false);Sclas.setEditable(false);Sbirth.setEditable(false);Snation.setEditable(false);Syear.setEditable(false);Sgrade.setEditable(false);Stel.setEdit
51、able(false);Saddress.setEditable(false);catch(Exception e)e.printStackTrace();else if(ae.getSource()=btnModify)tryDriverManager.registerDriver(newcom.microsoft.sqlserver.jdbc.SQLServerDriver();Connectioncnn=DriverManager.getConnection(jdbc:sqlserver:/localhost:1433;databasename=master,sa,123);Statem
52、ent stmt=cnn.createStatement();System.out.println(Updateshujukuset精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除Sname=+Sname.getText()+,Ssex=+Ssex.getText()+,Sclas=+Sclas.getText()+,Sbirth=+Sbirth.getText()+,Snation=+Snation.getText()+,Syear=+Syear.getText()+,Sgrade=+Sgrade.getText()+,Stel=+Stel.getText()+,S
53、address=+Saddress.getText()+Sno=+Sno.getText()+);wherestmt.executeUpdate(UpdateshujukusetSname=+Sname.getText()+,Ssex=+Ssex.getText()+,Sclas=+Sclas.getText()+,Sbirth=+Sbirth.getText()+,Snation=+Snation.getText()+,Syear=+Syear.getText()+,Sgrade=+Sgrade.getText()+,Stel=+Stel.getText()+,Saddress=+Saddr
54、ess.getText()+ where Sno=+Sno.getText()+);JOptionPane.showMessageDialog(null, 記錄修改完畢!, 提示, JOptionPane.INFORMATION_MESSAGE);btnModify.setEnabled(false);Sno.setText();Sname.setText();Ssex.setText();Sclas.setText();Sbirth.setText();Snation.setText();精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除Syear.setText()
55、;Sgrade.setText();Stel.setText();Saddress.setText();Sname.setEditable(false);Ssex.setEditable(false);Sclas.setEditable(false);Sbirth.setEditable(false);Snation.setEditable(false);Syear.setEditable(false);Sgrade.setEditable(false);Stel.setEditable(false);Saddress.setEditable(false);stmt.close();cnn.c
56、lose();catch(Exception e)e.printStackTrace();精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除public static void main(String args) new Modify();(五)、查詢:Searchimport java.awt.*;import javax.swing.*;import java.awt.event.*;import java.sql.*;public class Search extends JFrame implements ActionListener/*查詢學生信息控件*/st
57、atic Search s;JPanel jpl = new JPanel();JLabel SCH = new JLabel(查詢學生信息,JLabel.CENTER);JLabel label1 = new JLabel(輸入學號:,JLabel.CENTER);精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除JButton serch = new JButton(查詢);JLabel label3 = new JLabel(姓名:,JLabel.CENTER);JLabel label4 = new JLabel(性別:,JLabel.CENTER);JLabe
58、l label5 = new JLabel(班級:,JLabel.CENTER);JLabel label6 = new JLabel(生日:,JLabel.CENTER);JLabel label7 = new JLabel(政治面貌:,JLabel.CENTER);JLabel label8 = new JLabel(入學年份:,JLabel.CENTER);JLabel label9 = new JLabel(入學成績:,JLabel.CENTER);JLabel labelA = new JLabel(聯(lián)系方式:,JLabel.CENTER);JLabel labelB = new J
59、Label(家庭住址:,JLabel.CENTER);JTextField Ssex = new JTextField();JTextField Sno = new JTextField(2);JTextField Sname = new JTextField(4);JTextField Sclas = new JTextField();JTextField Sbirth = new JTextField();JTextField Snation = new JTextField();JTextField Syear = new JTextField();JTextField Sgrade =
60、 new JTextField();JTextField Stel = new JTextField();JTextField Saddress = new JTextField();精品好資料-如有侵權(quán)請聯(lián)系網(wǎng)站刪除 最新好資料推薦-如有侵權(quán)請聯(lián)系網(wǎng)站刪除JButton reset = new JButton(重置);public Search()this.setSize(500,600);this.setTitle(查詢學生信息);this.setVisible(true);this.setResizable(false);this.setDefaultCloseOperation(JFr
溫馨提示
- 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)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年合同到期解約申請模板
- 2025年藥店店員合同模板
- 一年級下冊數(shù)學教案-兩位數(shù)加減整十數(shù)、一位數(shù)的口算 (20)-西師大版
- 分數(shù)的初步認識(一)練習十一(教案)2024-2025學年數(shù)學三年級上冊 蘇教版
- 2024年人工種植牙項目投資申請報告代可行性研究報告
- 2025年杭州科技職業(yè)技術(shù)學院單招職業(yè)傾向性測試題庫1套
- 2025屆黑龍江省“六校聯(lián)盟”高三上學期聯(lián)考化學試題及答案
- 2025年度教師專業(yè)成長路徑規(guī)劃聘用合同
- 2025年度養(yǎng)老產(chǎn)業(yè)簡易版股份轉(zhuǎn)讓合同模板
- 2025年度文化旅游產(chǎn)業(yè)合作授權(quán)委托書
- 銀行營銷術(shù)語演練
- 工藝品雕刻工國家職業(yè)標準(2024版)
- 胃管的觀察與護理
- 室內(nèi)墻地磚鋪貼施工技術(shù)交底
- 醫(yī)院培訓課件:《成人住院患者靜脈血栓栓塞癥的預(yù)防護理》
- 國企單位聘用職業(yè)經(jīng)理人合同范本
- 2024-2030年中國廢棄電器電子產(chǎn)品回收處理行業(yè)發(fā)展狀況及投資規(guī)劃分析報告版
- 2024年河北省公務(wù)員考試《行測》真題及答案解析
- 期末復(fù)習試題(試題)-2024-2025學年四年級上冊數(shù)學人教版
- JJF 2161-2024焊接檢驗尺校準規(guī)范
- 《實踐論》(原文)毛澤東
評論
0/150
提交評論