學生學籍管理系統_學生登陸系統查詢與修改資訊
SCx.java
package studentManage; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.sql.*; public class SCx extends JFrame implements ActionListener { static SCx s; static JLabel label1 = new JLabel("學號:"); static JTextField textField1 = new JTextField(""); static JLabel label2 = new JLabel("姓名:"); static JTextField textField2 = new JTextField(""); static JLabel label3 = new JLabel("班級:"); static JTextField textField3= new JTextField(""); static JLabel label4 = new JLabel("專業:"); static JTextField textField4 = new JTextField(""); static JLabel label5 = new JLabel("院系:"); static JTextField textField5 = new JTextField(""); static JLabel label6 = new JLabel("性別"); static JTextField textField6 = new JTextField(""); static JLabel label7 = new JLabel("年級:"); static JTextField textField7 = new JTextField(""); static JLabel label8 = new JLabel("生日"); static JTextField textField8 = new JTextField(""); static JLabel label9 = new JLabel("電話:"); static JTextField textField9 = new JTextField(""); static JLabel label10 = new JLabel("QQ:"); static JTextField textField10 = new JTextField(""); static JLabel label11 = new JLabel("狀態:"); static JTextField textField11 = new JTextField(""); static JLabel label12 = new JLabel("密碼:"); static JTextField textField12 = new JTextField(""); static JButton button3 = new JButton("查詢"); static JButton button4 = new JButton("修改"); //初始化介面 public SCx() throws Exception { this.setTitle("查詢學生資訊"); this.setLayout(null); this.setSize(600, 600); label1.setBounds(30, 11, 50, 30); //學號 textField1.setBounds(60, 16, 70, 20); label2.setBounds(160, 11, 50, 30);//姓名 textField2.setBounds(190, 16, 70, 20); label3.setBounds(290, 11, 50, 30);//班級 textField3.setBounds(320, 16, 70, 20); //=========== label4.setBounds(30, 61, 50, 30);//專業 textField4.setBounds(60, 66, 70, 20); label5.setBounds(160, 61, 50, 30);//系別 textField5.setBounds(190, 66, 70, 20); label6.setBounds(290, 61,50, 30);//性別 textField6.setBounds(320, 66, 70, 20); //=========== label7.setBounds(30, 111, 50, 30);//年級 textField7.setBounds(60, 116, 70, 20); label8.setBounds(140, 111, 50, 30);//出生日期 textField8.setBounds(190, 116, 70, 20); label9.setBounds(290, 111, 50, 30);//電話 textField9.setBounds(320, 116, 70, 20); //========= label10.setBounds(30, 161, 50, 30);//QQ textField10.setBounds(60,166,70,20 ); label11.setBounds(160, 161, 50, 30);//狀態 textField11.setBounds(190,166, 70, 20); label12.setBounds(290, 161, 51, 33);//密碼 textField12.setBounds(320,166, 70, 22); button3.setBounds(150, 241, 80, 33); button4.setBounds(250, 241, 80, 33); button3.addActionListener(this); button4.addActionListener(this); this.add(label1); this.add(label2); this.add(label3); this.add(label4); this.add(label5); this.add(label6); this.add(label7); this.add(label8); this.add(label9); this.add(label10); this.add(label11); this.add(label12); this.add(textField1); this.add(textField2); this.add(textField3); this.add(textField4); this.add(textField5); this.add(textField6); this.add(textField7); this.add(textField8); this.add(textField9); this.add(textField10); this.add(textField11); this.add(textField12); this.add(button3); this.add(button4); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setVisible(true); } public static void main(String[] args) throws Exception { SCx a = new SCx(); a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void actionPerformed(ActionEvent e) { if (e.getSource() == button3) { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException ce) { JOptionPane.showMessageDialog(s, ce.getMessage()); } try { Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/stu","root","111"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from infor where stuId='" + textField1.getText() + "'"); if (textField1.getText().trim().equals("")) { JOptionPane.showMessageDialog(this, "學號不可為空!"); } else if (rs.next()) { textField1.setText(rs.getString("stuId")); textField2.setText(rs.getString("name")); textField3.setText(rs.getString("class")); textField4.setText(rs.getString("profess")); textField5.setText(rs.getString("depart")); textField6.setText(rs.getString("sex")); textField7.setText(rs.getString("grade")); textField8.setText(rs.getString("bir")); textField9.setText(rs.getString("phone")); textField10.setText(rs.getString("QQ")); textField11.setText(rs.getString("state")); textField12.setText(rs.getString("password")); } else { JOptionPane.showMessageDialog(this, "無此記錄!!!"); } } catch (SQLException se) { JOptionPane.showMessageDialog(s, se.getMessage()); } } if(e.getSource()==button4) { try{ Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException ce) { JOptionPane.showMessageDialog(s,ce.getMessage()); } try { Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/stu","root","111"); Statement stmt = con.createStatement(); ResultSet rs=stmt.executeQuery("select * from infor where stuId='"+textField1.getText()+"'"); if(textField1.getText().trim().equals("")) { JOptionPane.showMessageDialog(this,"學號不可為空!"); }else if(rs.next()) { try{ stmt.execute("update infor set name='"+ textField2.getText()+"',class='"+textField3.getText()+"',profess='"+ textField4.getText()+"',depart='"+textField5.getText()+"',sex='"+ textField6.getText()+"',grade='"+textField7.getText()+"',bir='"+ textField8.getText()+ "',phone='"+textField9.getText()+"',QQ='"+textField10.getText()+ "',state='"+textField11.getText()+"',password='"+textField12.getText() +"'where stuId='"+textField1.getText ()+"'" ); JOptionPane.showMessageDialog(null,"修改成功"); } //stmt.executeQuery(updateSql);} // stmt.executeUpdate(updateSql);} catch(SQLException se) { //JOptionPane.showMessageDialog(null,"請輸入正確的資訊"); JOptionPane.showMessageDialog(s,se.getMessage()); } } } catch(SQLException se) { JOptionPane.showMessageDialog(s,se.getMessage()); } } } }
SInterface.java
package studentManage; import java.awt.*; import java.awt.event.*; import javax.swing.*; /* * 學生登入 * 操作介面介面類,可以直接擴充套件、呼叫。 */ public class SInterface extends JFrame implements ActionListener { static JMenuBar jMenuBar = new JMenuBar();// 選單條 static JMenu jMenuFile = new JMenu("檔案");// 選單項 static JMenu jMenuExit = new JMenu("退出"); //static JMenuItem jMenuItem1 = new JMenuItem("新增資訊");// 選單子項 static JMenuItem jMenuItem2 = new JMenuItem("修改資訊"); static JMenuItem jMenuItem3 = new JMenuItem("資訊查詢"); //static JMenuItem jMenuItem4 = new JMenuItem("刪除資訊"); static JLabel label3 = new JLabel("請選擇操作項"); static JLabel label4 = new JLabel("學籍管理系統"); //static JButton button2 = new JButton("新增資訊"); static JButton button3 = new JButton("修改資訊"); static JButton button4 = new JButton("資訊查詢"); //static JButton button5 = new JButton("刪除資訊"); public SInterface() { this.setTitle("學籍管理系統"); this.setLayout(null); this.setSize(400, 400); label3.setBounds(158, 92, 98, 33); label3.setFont(new Font("Dialog", Font.PLAIN, 15)); label4.setFont(new Font("Dialog", Font.BOLD, 20)); label4.setBounds(157, 37, 280, 40); //button2.setBounds(74, 136, 97, 33); button3.setBounds(226, 136, 97, 33);//修改資訊 button4.setBounds(74, 136, 97, 33);//資訊查詢 //button5.setBounds(226, 185, 97, 33); //this.add(button2); this.add(button3); this.add(button4); //this.add(button5); this.add(label3); this.add(label4); setJMenuBar(jMenuBar); //jMenuFile.add(jMenuItem1);// ”檔案“選單項中加入子選單 jMenuFile.add(jMenuItem2); jMenuFile.add(jMenuItem3); //jMenuFile.add(jMenuItem4); jMenuBar.add(jMenuFile);// 將選單項加入選單條 jMenuBar.add(jMenuExit); //button2.addActionListener(this);// 本視窗向按鈕事件源註冊 button3.addActionListener(this); button4.addActionListener(this); //button5.addActionListener(this); //jMenuItem1.addActionListener(this);// 本視窗選單子項註冊 jMenuItem2.addActionListener(this); jMenuItem3.addActionListener(this); //jMenuItem4.addActionListener(this); jMenuExit.addActionListener(this); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); } public static void main(String[] args) { SInterface a = new SInterface(); } public void actionPerformed(ActionEvent e) // 按鈕事件的處理 { if (e.getSource() == jMenuExit) { System.exit(0); } if (e.getSource() == jMenuItem3 || e.getSource() == button4) { try { SCx a = new SCx(); } catch (Exception ec) { } } } }
SXg.java
package studentManage; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.sql.*; public class SXg extends JFrame implements ActionListener { static SXg s; static JLabel label1 = new JLabel("學號:"); static JTextField textField1 = new JTextField(""); static JLabel label2 = new JLabel("姓名:"); static JTextField textField2 = new JTextField(""); static JLabel label3 = new JLabel("性別:"); static JTextField textField7 = new JTextField(""); static JLabel label4 = new JLabel("出生日期:"); static JTextField textField3 = new JTextField(""); static JLabel label5 = new JLabel("政治面貌:"); static JTextField textField8 = new JTextField(""); static JLabel label6 = new JLabel("籍貫"); static JTextField textField4 = new JTextField(""); static JLabel label7 = new JLabel("系別:"); static JTextField textField9 = new JTextField(""); static JLabel label8 = new JLabel("專業:"); static JTextField textField5 = new JTextField(""); static JButton button2 = new JButton("修改"); public SXg() { this.setTitle("修改學生資訊"); this.setLayout(null); this.setSize(400, 400); label1.setBounds(30, 11, 51, 33); textField1.setBounds(86, 16, 74, 22); label2.setBounds(162, 11, 51, 33); textField2.setBounds(192, 16, 44, 22); label3.setBounds(241, 11, 70, 33); textField7.setBounds(275, 15, 50, 25); label4.setBounds(31, 53, 55, 33); textField3.setBounds(86, 58, 74, 22); label5.setBounds(241, 53, 70, 33); textField8.setBounds(296, 57, 72, 25); label6.setBounds(163, 53, 26, 33); textField4.setBounds(191, 58, 44, 22); label7.setBounds(30, 94, 50, 33); textField9.setBounds(86, 94, 74, 22); label8.setBounds(163, 94, 51, 33); textField5.setBounds(190, 99, 178, 22); button2.setBounds(115, 241, 80, 33); button2.addActionListener(this); this.add(label1); this.add(label2); this.add(label3); this.add(label4); this.add(label5); this.add(label6); this.add(label7); this.add(label8); this.add(textField1); this.add(textField2); this.add(textField3); this.add(textField4); this.add(textField5); this.add(textField7); this.add(textField8); this.add(textField9); this.add(button2); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setVisible(true); } public static void main(String[] args) throws Exception { SXg a = new SXg(); a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void actionPerformed(ActionEvent e)//事件處理程式 { if(e.getSource()==button2) { try{ Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException ce) { JOptionPane.showMessageDialog(s,ce.getMessage()); } try { Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/stu","root","111"); Statement stmt = con.createStatement(); ResultSet rs=stmt.executeQuery("select * from infor where stuId='"+textField1.getText()+"'"); if(textField1.getText().trim().equals("")) { JOptionPane.showMessageDialog(this,"學號不可為空!"); }else if(rs.next()) { try{ stmt.execute("update infor set stuId='"+textField1.getText()+"',name='"+ textField2.getText()+"',sex='"+textField7.getText()+"',birDate='"+ textField3.getText()+"',look='"+textField8.getText()+"',jiGuan='"+ textField4.getText()+"',xiBie='"+textField9.getText()+"',zhuanYe='"+ textField5.getText()+ "'"); JOptionPane.showMessageDialog(null,"修改成功"); } //stmt.executeQuery(updateSql);} // stmt.executeUpdate(updateSql);} catch(SQLException se) { //JOptionPane.showMessageDialog(null,"請輸入正確的資訊"); JOptionPane.showMessageDialog(s,se.getMessage()); } } } catch(SQLException se) { JOptionPane.showMessageDialog(s,se.getMessage()); } } } }
相關推薦
學生學籍管理系統_學生登陸系統查詢與修改資訊
SCx.java package studentManage; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.sql.*; public class SCx
學生學籍管理系統_需求分析
內容:設計學生學籍管理程式 該程式實現以下功能: 學生登入系統可以檢視自己的基本資訊,可以修改密碼、修改電話、Email地址、QQ號等資訊; 管理員可以註冊新的學生、修改學生基本資訊、查詢學生基本資
【練手程式】簡單的學生學籍管理系統
這是個簡單的學籍管理系統,將學生資訊放在大字典當中,以學生學號為鍵,以包括學生其他資訊的一個小字典為值,做到了對簡單資訊的增刪改查。 以下為原始碼(因為語言表述不準確,所以未在程式內進行註釋,怕註釋不能盡其義): def ReadFromFile(path): with open
JDBC練習 學生學籍管理系統1.0(sql server)
import java.sql.*; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class SqlLink { static Scanner sc=new Sca
Android管理聯絡人(包含新增,查詢,修改和刪除;以及不同版本區別)
通過Android系統提供的介面,可以很方便的管理聯絡人資訊。一、新增1、新增聯絡人1.6上的程式碼:String peopleName = "name";ContentValues personValues = new ContentValues();// namepers
JavaWeb學生資訊管理系統_查詢V1.0
專案簡介 1)在MySQL資料庫中建立一個StudentGradeTable資料表,新增欄位FlowId,Type,IdCard,ExamCard,StudentName,Location,Grade並錄入幾條資料 2)簡單實用MVC設計模式,model為Stude
高校學生學籍系統C++&mysql
pos 信息 系統 inpu amp win update != options /*C++程序設計實踐教學環節任務書 一、題目:高校學籍管理系統 二、目的與要求 1. 目的: 1.掌握C++語言基本知識及其編程方法 2.掌握類和對象的基本概念與用法 3.掌握面向對象
團隊-學生成績管理系統-需求分析
統計 window 操作 目的 信息 測試 硬盤空間 visual 團隊 1.1 編寫目的 該需求分析的軟件對象是學生管理系統。開發學生管理系統能夠為用戶提供充足的信息和快捷的查詢手段。作為計算機應用的一部分,使用計算機對學籍信息進行管理,具有著手工管理所無法比擬的優點。如
python--學校管理系統(在學校接口上,增加了老師的管理接口和學生的管理接口)
建立 load style inpu core open .com 只需要 繼續 和上一篇隨筆一樣的要求,完善了一下老師接口和學生接口。 搞清楚了一件事情,就是import那麽多文件,該怎麽搞才比較方便。 1、先上文件目錄 在lib中定義了各個類,一看名字就知道是啥類了哦
asp.net299學生成績管理系統-畢業設計
asp.net 學生 畢業設計 轉載於www.taobysj.com 作者 QQ 97095639 技術實現 開發語言:asp.net.框架:mvc.模式:B/S.數據庫:sqlserver.開發工具:vs,sqlserver.論文字數:1萬左右.
學生成績管理系統
input span lse div stdlib.h avr num char using 1 #include<stdio.h> 2 #include<string.h> 3 #include<stack>
java陣列——用陣列實現學生姓名管理系統
1.需求:可以加入相同的學生姓名 package demo; import java.util.Arrays; import java.util.Scanner; /* * ==========歡迎使用學生管理系統1.0版本========= 1. 新增學生 2.刪除學生 3.修改
高校學生工作管理資訊系統的設計與實現--文獻隨筆(一)
一、基本資訊 標題:高校學生工作管理資訊系統的設計與實現 時間:2014 出版源:浙江工業大學 領域分類:系統設計與實現 二、研究背景 問題定義:實現學生工作管理的資訊化,大學生思想政治教育的資訊化 難點:高校學生工作管理系統對資料安全要求高,伺服器及網路環境應有專職人員維護 相關工作:系統採用B/S
課程設計:學生檔案管理系統
一、 程式設計的題目 ——學生檔案管理系統 二、 程
基於MFC的學生成績管理系統的設計與實現
1、技術介紹MFC是微軟基礎類庫的簡稱,是微軟公司實現的一個C++類庫,主要封裝了大部分的WINDOWS API函式,並且包含一個應用程式框架,以減少應用程式開發人員工作量。VC++是微軟公司開發的C/C++的整合開發環境,所謂整合開發環境,就是說利用它你可以編輯,編譯,除錯,而不是使用多種工具輪換操作,靈活
C語言實現班級學生成績管理系統
#include <stdio.h> #include <stdlib.h> #include <math.h> struct Student//學生結構 { char Name[10];//姓名
基於sqlserver資料庫的學生成績管理系統
目錄 學生資料編輯介面: 學生資料查詢介面: 完整專案原始碼:https://download.csdn.net/download/qq_40323256/10777385 文件介紹:https://wenku.baidu.com/view/96a3284c5
基於ASP.NET高職學生工作管理系統--文獻隨筆(八)
流程 CMF [1] 數據信息 經濟 ron 學校 評價 素質 一、基本信息 標題:基於ASP.NET高職學生工作管理系統 時間:2015 出版源:電子科技大學 關鍵詞:高職; 學生管理; ASP.NET; 系統; 二、研究背景 問題定義:隨著社會的發展,我國經濟的發展,尤
用容器相關知識寫的一個簡單的學生成績管理系統
這是我學習完容器 相關知識後,自己編寫的一個簡單的學生成績管理系統,實現基本的增、刪、改、查四個功能,後面有時間會增加一個按照平均分排名的功能; 1: main函式: 程式入口 package studentScoreSystem; import java.util.Scanner;
高校學生工作管理系統的分析與設計--文獻隨筆(十二)
決定 不用 功能 ref 技術 決策 模塊化 CMF 要求 一、基本信息 標題:高校學生工作管理系統的分析與設計 時間:2013 出版源:雲南大學 關鍵詞:B/S; 高校學生工作管理; 信息系統; 二、研究背景 問題定義:此系統的開發有效的減輕學校相關工作人員的工作負擔,同