学生信息管理系统+SQL数据库

上传人:s9****2 文档编号:564784838 上传时间:2023-02-27 格式:DOCX 页数:13 大小:20.97KB
返回 下载 相关 举报
学生信息管理系统+SQL数据库_第1页
第1页 / 共13页
学生信息管理系统+SQL数据库_第2页
第2页 / 共13页
学生信息管理系统+SQL数据库_第3页
第3页 / 共13页
学生信息管理系统+SQL数据库_第4页
第4页 / 共13页
学生信息管理系统+SQL数据库_第5页
第5页 / 共13页
点击查看更多>>
资源描述

《学生信息管理系统+SQL数据库》由会员分享,可在线阅读,更多相关《学生信息管理系统+SQL数据库(13页珍藏版)》请在金锄头文库上搜索。

1、本人亲自做的,不需要做任何修改即可顺利运行,sql表也与程序无缝连接,没有未识别部 分。Sql 表如下:CREATE TABLE STU( 学号 varchar(14) PRIMARY KEY, 姓名 varchar(8) NOT NULL, 密码 varchar(8) NOT NULL, 班级 varchar(14) NOT NULL , 性别 varchar(2), 学校 varchar(14) NOT NULL);CREATE TABLE TCH( 用户名 varchar(8) NOT NULL, 密码 varchar(8) NOT NULL );CREATE TABLE 成绩表( 学号

2、 varchar(14) PRIMARY KEY, 计算机网络 varchar(8) NOT NULL, 汽车概论 varchar(8) NOT NULL, 初级日语 varchar(8) NOT NULL, 接口技术 varchar(8) NOT NULL, ava 程序设计 varchar(8) NOT NULL, 数据库 varchar(8) NOT NULL, 大学物理 varchar(8) NOT NULL);源程序代码: import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.sql

3、.*;public class systems extends JFrame implements ActionListenerstatic systems ss;JPanel panel = new JPanel();JLabel labell = new JLabel(输入姓名:”); JTextField name = new JTextField();JLabel label2 = new JLabel(密码:”);JPasswordField pwd = new JPasswordField(); JButton Enter = new JButton(” 登录”); JButton

4、 Exit = new JButton (退出); String url = D:Systemstitle.jpg; ButtonGroup bgp = new ButtonGroup(); JRadioButton stu = new JRadioButton(学生”);JRadioButton tch = new JRadioButton(” 教师”);public systems()super(”登录系统”); this.setResizable(false); JLabel img = new JLabel(new ImageIcon(url); img.setBounds(0,0,5

5、00,100);panel.add(img); stu.setBounds(165,210,70,20); tch.setBounds(265,210,70,20); bgp.add(stu); bgp.add(tch); panel.add(stu); panel.add(tch);Enter.setBounds(150,250,80,20);Exit.setBounds(270,250,80,20);Enter.addActionListener(this); Exit.addActionListener(this); panel.add(Enter); panel.add(Exit);

6、panel.setLayout(null); this.add(panel);label1.setBounds(135,130,100,25);panel.add(label1); name.setBounds(265,130,100,25);panel.add(name); label2.setBounds(135,165,100,25);panel.add(label2); pwd.setBounds(265,165,100,25); panel.add(pwd);this.setBounds(100,100,500,350); this.setVisible(true); this.se

7、tDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);public void actionPerformed(ActionEvent e)if(e.getSource()=Enter)String username , password; username = name.getText(); password = pwd.getText(); tryClass.forName(oracle.jdbc.driver.OracleDriver);catch (ClassNotFoundException ce)JOptionPane.showMessageDia

8、log(ss,ce.getMessage();if(stu.isSelected()tryConnection con =DriverManager.getConnection(jdbc:oracle:thin:user29:1521:XE,hr,oracle);Statement stmt = con.createStatement();ResultSet rs = stmt.executeQuery(select * from STU);while(rs.next()if(rs.getString( 学 号 ).equals(username)&(rs.getString( 密 码 ).e

9、quals(password)JOptionPane.showMessageDialog(ss,登陆成功”);Students stu = new Students();elseJOptionPane.showMessageDialog(ss,登录失败);rs.close();stmt.close();catch (SQLException se)JOptionPane.showMessageDialog(ss,se.getMessage();else if(tch.isSelected()tryConnectioncon=DriverManager.getConnection(jdbc:or

10、acle:thin:user29:1521:XE,hr,oracle);Statement stmt = con.createStatement();ResultSet rs = stmt.executeQuery(select * from TCH);while(rs.next()if(rs.getString(”用户名).equals(username)&(rs.getString(”密码 ).equals(password)JOptionPane.showMessageDialog(ss,登陆成功”);elseJOptionPane.showMessageDialog(ss,登录失败);

11、catch (SQLException se)JOptionPane.showMessageDialog(ss,se.getMessage();elseSystem.exit(0);public static void main(String args)systems sys = new systems();import java.awt.*;import javax.swing.*;import java.awt.event.*;public class Students extends JFrame implements ActionListenerJMenuBar jmb = new J

12、MenuBar();JMenu Message = new JMenu(信息”);JMenu Score = new JMenu(” 成绩”);JMenuItem Iteml = new JMenuItem(插入);JMenuItem Item2 = new JMenuItem(” 查询”);JMenuItem Item3 = new JMenuItem(” 查询”);public Students()super(”学生界面”);this.setSize(500,400);this.setVisible(true);this.setResizable(false); this.setDefau

13、ltCloseOperation(JFrame.EXIT_ON_CLOSE); this.setJMenuBar(jmb);jmb.add(Message);jmb.add(Score);Message.add(Item1);Message.add(Item2);Score.add(Item3);Item1.addActionListener(this);Item2.addActionListener(this);Item3.addActionListener(this);public void actionPerformed(ActionEvent e)if(e.getSource()=It

14、em1)AddMsg ad = new AddMsg();else if(e.getSource()=Item2)Serch ser = new Serch();elsepublic static void main(String args)Students stu = new Students();import java.awt.*;import javax.swing.*;import java.awt.event.*; public class Teachers extends JFrame implements ActionListener JMenuBar bar = new JMe

15、nuBar();JMenu menul = new JMenu(” 信息”);JMenu menu2 = new JMenu(成绩”);JMenuItem iteml = new JMenuItem(录入信息”);JMenuItem item2 = new JMenuItem(录入成绩); JPanel jpl = new JPanel();public Teachers() super(”教师界面”); this.setSize(500,300); this.setResizable(false); this.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setJMenuBar(bar);this

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 学术论文 > 其它学术论文

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号