JAVA连接sqlserver学生成绩管理系统
计算机毕业论文_基于JAVA的学生成绩管理系统的设计与实现

基于JA V A的学生成绩管理系统的设计与实现THE DESIGN AND REALIZATION OF THE RESULT OF STUDENT ADMINISTRATION MANAGEMENT SYSTEM ON THE JA V A学生姓名:学号:年级专业:指导老师:学院:提交日期:2009年11月目录摘要 2前言 41 需求分析 41.1 功能需求分析 41.2 性能需求分析 51.3 数据库需求分析――数据流图 51.4数据结构分析――数据流图 62概要结构设计 92.1系统功能结构设计 92.2 数据库概念结构设计 103逻辑结构设计 104详细设计及功能实现 114.1模块设计与实现 115总结 21参考文献 21致谢 21基于Java的学生成绩管理系统的设计与实现作者:周亚平指导老师:陈义明(湖南农业大学科学技术师范学院2004级计算机科学与技术专业教育班,长沙410128)摘要:随着计算机技术的飞速发展和高等教育体制改革的不断深入,传统教育管理方法、手段以及工作效率已不能适应新的发展需要,无法很好地完成教学管理工作。
提高教学管理水平的主要途径是更新管理者的思想,增强对管理活动的科学认识。
基于Java与SQL server 数据库技术建立一个高校成绩管理系统该系统为管理员、学生和教师提供了查询、修改、增加记录、删除等功能,功能比较落齐全,基本上能满足学生和老师的要求。
关键词:Java;需求分析;概要设计;学生成绩管理系统;The Design And Realization Of the educational administration management system Based On JA V AAuthor: Zhou yappingTutor: Chen yiming(School of Information Science technique normal school,Hunan AgriculturalUniversity,Changsha, 410128)Abstract: Fly technically along with the calculator to develop soon and the higher education system reform of continuously thorough, traditional education management the method, means and work efficiencies have already can't adapt the new development demand, can't complete the teaching management work nicely.The main path that raises the educational administration management level is a thought that renews the governor, strengthenning the science understanding to manage the activity.According to the JA V A build up that system of an educational administration of high school management system's pursue studies with the database technique to living to provided the search, modify, save, increase the record and select elective courses etc. with teacher function, the function relatively falls well-found, can satisfy the request between student and teacher basically.Keyword:JA V A; The need analysis; The essentiadesign; Database; Detailed design前言学生成绩管理工作是高校教育工作的一项重要内容。
javaweb连接SQLserver详细步骤

(1)、将sqljd bc4.jar拷到安装java JDK所在目录下的\ jre \ lib \ ext 下,同时也要拷贝到安装to mcat的目录下的l ib文件夹下,如我的安装目录是d://apache-tomcat-6.0.35 \ lib,以上就是JD BC驱动的准备。
我用的是My eclip se,可以直接将s qljdb c4.jar拷到项目文件(2)、点开SQLServer配置管理器选中SQLServer2008网络配置下的SQLEX PRESS的协议,双击TCP/IP选项,打开如下窗口并更改TC P动态端口为0之后停止SQ LServ er(SQLEXP RESS)服务,并重启,到这里有关S QLSev er2005的配置就完成了。
如果之后遇到什么问题,可以尝试重新设置步骤(2)。
(3)、设置数据库自己设置密码。
然后确定,退出。
在这里我的数据库名字是这个。
一会儿要用到。
设置好数据库可以退出了。
当然可以尝试sa登陆一下如果失败,就尝试重启服务器。
(4)、在代码中的实现连接String driverN ame = "com.micros oft.sqlserver.jdbc.SQLServerDriver"; //加载JDBC驱动String dbURL = "jdbc:sqlserver://localh o st:1433; Databa seNam e=StudentManagement"; //连接服务器和数据库sa mpleString userName = "sa"; //默认用户名String userPw d = "sa123"; //密码Connec tion dbConn;try {Class.forNam e(driverN ame);dbConn = DriverManag er.getCon nection(dbURL, userName, userPw d);System.out.println("Connec tionSucces sful!"); //如果连接成功控制台输出Connec tion Succes sful!} catch (Except ion e) {e.printS tackTrace();}如果服务器连接成功,则然后就可以使用了,如果直接复制本文件代码,运行是有可能提示字符转换,如果出错可尝试自己手动输入。
学生成绩管理系统

学生管理系统源代码:MySql与Myeclipse连接//连接数据库import java.sql.*;public class MyConnection {protected static ResultSet re;protected static String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; // 加载JDBC驱动protected static String dbURL = "jdbc:sqlserver://STONE-PC\\SQLEXPRESS:1433; DatabaseName=D01hexia"; // 连接服务器和数据库sampleprotected static String userName = "何霞"; // 默认用户名protected static String userPwd = "828"; // 密码protected static Connection conn;protected static Statement stmt;public ResultSet getResult(String sql) {try {Class.forName(driverName);conn = DriverManager.getConnection(dbURL, userName, userPwd);stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDA TABLE);re = stmt.executeQuery(sql);return re;} catch (Exception e) {System.out.println("getResult------" + e.toString());return null;}}public boolean executeSql(String sql) {try {Class.forName(driverName);conn = DriverManager.getConnection(dbURL, userName, userPwd);stmt = conn.createStatement();stmt.executeUpdate(sql);mit();return true;} catch (Exception e) {System.out.println("executeSql----" + e.toString());return false;}}}主登录界面:import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.sql.*;public class LogInMainFrame extends JFrame implements ActionListener { private JLabel userID;private JLabel userPWD;private JTextField userIDT;private JTextField userPWDT;private JRadioButton teacherRB;private JRadioButton studentRB;private JButton logInBut;private JButton cancelBut;private JLabel label;private ButtonGroup bg;private ImageIcon icon;private static String currentUser;public String getCurrentUser() {return currentUser;}public void setCurrentUser(String currentUser) {LogInMainFrame.currentUser = currentUser;}public LogInMainFrame() {super("学生生成绩管理系统");label = new JLabel();icon = new ImageIcon("src/images/a.jpg");label.setIcon(icon);label.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());setSize(label.getWidth(), label.getHeight());userID = new JLabel("ID号:"); userPWD = new JLabel("密码:"); userIDT = new JTextField(null, 15); userPWDT = new JPasswordField(null, 15); teacherRB = new JRadioButton("教师"); studentRB = new JRadioButton("学生"); logInBut = new JButton("登录"); cancelBut = new JButton("取消");bg = new ButtonGroup();setLayout(null);// 登录取消按钮设置logInBut.setBounds(110, 170, 60, 20); logInBut.setBackground(Color.red); cancelBut.setBounds(210, 170, 60, 20); cancelBut.setBackground(Color.red);// ID密码设置userID.setBounds(90, 50, 80, 35); userPWD.setBounds(90, 100, 80, 35); userIDT.setBounds(120, 50, 150, 35); userPWDT.setBounds(120, 100, 150, 35);// 教师学生按钮设置teacherRB.setBounds(200, 20, 70, 30); studentRB.setBounds(120, 20, 70, 30); teacherRB.setSelected(false); studentRB.setSelected(false); teacherRB.setContentAreaFilled(false); studentRB.setContentAreaFilled(false);add(logInBut);add(cancelBut);add(userID);add(userIDT);add(userPWD);add(userPWDT);add(teacherRB);add(studentRB);bg.add(teacherRB);bg.add(studentRB);add(label);setResizable(false);setVisible(true);setLocationRelativeTo(null); // 设置登录页面在屏幕中的位置setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);logInBut.addActionListener(this);cancelBut.addActionListener(this);}public void actionPerformed(ActionEvent e) {if (e.getSource() == cancelBut) { //当选择取消按钮时,推出系统System.exit(0);} else if (e.getSource() == logInBut) { //当选择登录按钮时String username, password;username = userIDT.getText();password = userPWDT.getText();if (teacherRB.isSelected()) {setCurrentUser("teacher");if (username.toString().equals("")) {JOptionPane.showMessageDialog(null, "请输入用户名!", "温馨提示",RMA TION_MESSAGE);} else if (password.toString().equals("")) {JOptionPane.showMessageDialog(null, "请输入密码!", "温馨提示",RMA TION_MESSAGE);} else {MyConnection conn = new MyConnection();ResultSet resultSet;String sql = "select * from Teachers_Hx where Tno_hx = '"+ username.toString() + "'and Tpassword_hx = '"+ password.toString() + "'";try {resultSet = conn.getResult(sql);st();if (resultSet.getRow() == 1){setVisible(false);resultSet.beforeFirst();while (resultSet.next()) {this.dispose();sql = "select * from Teachers_Hx";//进入教师管理界面new TeaMainFrame2();JOptionPane.showMessageDialog(null,resultSet.getString("Tname_hx")+"老师!您好!欢迎登录学生成绩管理系统!");}} else {JOptionPane.showMessageDialog(null, "用户名或密码错误","登录失败", RMA TION_MESSAGE);}} catch (Exception er) {System.out.println(er.toString());}}}if (studentRB.isSelected()) {setCurrentUser("student");//当用户名为空值时if (username.toString().equals("")) {JOptionPane.showMessageDialog(null, "请输入用户名!", "温馨提示",RMA TION_MESSAGE);//当密码为空值时} else if (password.toString().equals("")){JOptionPane.showMessageDialog(null, "请输入密码!", "温馨提示",RMA TION_MESSAGE);}else{setCurrentUser("student");MyConnection conn = new MyConnection();ResultSet resultSet;String sql = "select * from Students_Hx where Sno_hx ='"+ userIDT.getText().toString()+ "' and Spassword_hx = '"+ userPWDT.getText().toString() + "'";try {resultSet = conn.getResult(sql);st();if (resultSet.getRow() == 1) {setVisible(false);resultSet.beforeFirst();while (resultSet.next()) {this.dispose();sql = "select * from Students_Hx";new StuMainFrame2();JOptionPane.showMessageDialog(null,resultSet.getString("Sname_hx")+ "同学!您好!欢迎登录学生成绩管理系统!");}} else {JOptionPane.showMessageDialog(null, "用户名或密码错误","登录失败", RMA TION_MESSAGE);}} catch (Exception er) {System.out.println(er.toString());}}}}}public static void main(String[] args) {try {UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());} catch (Exception e) {}new LogInMainFrame();}}教师登录界面:import java.awt.Color;import java.awt.Container;import java.awt.GridLayout;import java.awt.Image;import java.awt.Toolkit;import java.awt.event.ActionEvent;import java.awt.event.*;import javax.swing.BorderFactory;import javax.swing.JFrame;import javax.swing.JMenu;import javax.swing.JMenuBar;import javax.swing.JMenuItem;import javax.swing.JOptionPane;import javax.swing.JPanel;public class TeaMainFrame2 extends JFrame implements ActionListener {JMenuBar jb = new JMenuBar();JMenu t1 = new JMenu("系统");JMenu t2 = new JMenu("学生数据操作");JMenu t3 = new JMenu("教师数据操作");JMenu t4 = new JMenu("课程和专业数据操作");JMenu t5 = new JMenu("帮助");private JMenuItem i1;JMenuItem i2 = new JMenuItem("查询学生基本信息");JMenuItem i3 = new JMenuItem("查询学生成绩信息");JMenuItem i4 = new JMenuItem("添加学生成绩信息");JMenuItem i5 = new JMenuItem("查询教师基本信息");JMenuItem i6 = new JMenuItem("修改教师基本信息");JMenuItem i7 = new JMenuItem("查询专业基本信息");JMenuItem i8 = new JMenuItem("查询课程基本信息");JMenuItem i9 = new JMenuItem("软件基本信息");TeaMainFrame2() {super("学生成绩管理系统:教师登录界面"); // 如果直接创建抽象实体,则无法添加窗口图标i1 = new JMenuItem("退出");Container c = getContentPane();JPanel pan1 = new JPanel();pan1.setLayout(new GridLayout(1, 1));pan1.add(jb);jb.setLayout(new GridLayout(5, 1));Color red = new Color(110, 150, 199);jb.setBackground(red);jb.add(t1);jb.add(t2);jb.add(t3);jb.add(t4);jb.add(t5);t1.setBorderPainted(true);t1.setBorder(BorderFactory.createLineBorder(Color.black, 1));t2.setBorderPainted(true);t2.setBorder(BorderFactory.createLineBorder(Color.black, 1));t3.setBorderPainted(true);t3.setBorder(BorderFactory.createLineBorder(Color.black, 1));t4.setBorderPainted(true);t4.setBorder(BorderFactory.createLineBorder(Color.black, 1));t5.setBorderPainted(true);t5.setBorder(BorderFactory.createLineBorder(Color.black, 1));t1.setBorderPainted(true);t1.setBorder(BorderFactory.createLineBorder(Color.black, 1));t1.add(i1);t2.add(i2);t2.add(i3);t2.add(i4);t3.add(i5);t3.add(i6);t4.add(i7);t4.add(i8);t5.add(i9);c.add(pan1);setSize(380, 380);setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true);Toolkit tk = getToolkit();Image icon = tk.getImage("src/images/1.png"); setIconImage(icon);i1.addActionListener(this);i2.addActionListener(this);i3.addActionListener(this);i4.addActionListener(this);i5.addActionListener(this);i6.addActionListener(this);i7.addActionListener(this);i8.addActionListener(this);i9.addActionListener(this);}public void actionPerformed(ActionEvent e) {if (e.getSource() == i1) {LogInMainFrame log = new LogInMainFrame();log.setVisible(true);} else if (e.getSource() == i2) {dispose();new StuInforSearch().setVisible(true);} else if (e.getSource() == i3) {dispose();new GradeList().setVisible(true);} else if (e.getSource() == i4) {dispose();new StuInforAdd().setVisible(true);} else if (e.getSource() == i5) {dispose();new TeaInforSearch().setVisible(true);} else if (e.getSource() == i6) {dispose();new TeaInforFormModify().setVisible(true);} else if (e.getSource() == i7) {dispose();new DeptInforSearch().setVisible(true);} else if (e.getSource() == i8) {dispose();new CourseInforSearch().setVisible(true);} else {JOptionPane.showMessageDialog(this,"学生成绩管理系统\n\n计算机学院\n\n制作者\n\n何霞", "软件信息",RMA TION_MESSAGE);}}public static void main(String[] args) {new TeaMainFrame2();}}学生登录界面:import java.awt.Color;import java.awt.Container;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.BorderFactory;import javax.swing.JFrame;import javax.swing.JMenu;import javax.swing.JMenuBar;import javax.swing.JMenuItem;import javax.swing.JOptionPane;import javax.swing.JPanel;public class StuMainFrame2 extends JFrame implements ActionListener { private static final int JOptionPane_INFORMA TION_MESSAGE = 0;JMenuBar jb;JMenu system;JMenu addInfor;JMenu searchInfor;JMenu help;JMenuItem exit;JMenuItem mAbout;JMenuItem addStuInfor;JMenuItem searchStuScore;JMenuItem searchStuInfor;JMenuItem searchTeaInfor;JMenuItem searchCourseInfor;JMenuItem searchMajorInfor;StuMainFrame2(){super("学生成绩管理系统1:学生登录界面");jb=new JMenuBar();system=new JMenu("系统");addInfor=new JMenu("添加信息");searchInfor=new JMenu("信息查询");help=new JMenu("帮助");exit=new JMenuItem("退出");mAbout=new JMenuItem("系统信息");addStuInfor=new JMenuItem("添加学生信息");searchStuScore=new JMenuItem("查询学生成绩");searchStuInfor=new JMenuItem("查询学生信息");searchTeaInfor=new JMenuItem("查询教师信息"); searchCourseInfor=new JMenuItem("查询课程信息"); searchMajorInfor=new JMenuItem("查询专业信息");Container c = getContentPane();JPanel pan2 = new JPanel();pan2.setLayout(new GridLayout(1,1));pan2.add(jb);jb.add(system);system.setBorderPainted(true);system.setBorder(BorderFactory.createLineBorder(Color.black,1));jb.add(addInfor);addInfor.setBorderPainted(true);addInfor.setBorder(BorderFactory.createLineBorder(Color.black,1));jb.add(searchInfor);searchInfor.setBorderPainted(true);searchInfor.setBorder(BorderFactory.createLineBorder(Color.black,1));jb.add(help);help.setBorderPainted(true);help.setBorder(BorderFactory.createLineBorder(Color.black,1));system.add(exit);addInfor.add(addStuInfor);searchInfor.add(searchStuScore);searchInfor.add(searchStuInfor);searchInfor.add(searchTeaInfor);searchInfor.add(searchCourseInfor);searchInfor.add(searchMajorInfor);help.add(mAbout);jb.setLayout(new GridLayout(4,1));Color yellow=new Color(109,209,45);jb.setBackground(yellow);setSize(400,300);setVisible(true);c.add(pan2);setLocationRelativeTo(null);exit.addActionListener(this);addStuInfor.addActionListener(this);searchStuInfor.addActionListener(this);searchTeaInfor.addActionListener(this);searchCourseInfor.addActionListener(this);searchMajorInfor.addActionListener(this);searchStuScore.addActionListener(this);mAbout.addActionListener(this);}public void actionPerformed(ActionEvent e){if(e.getSource()==exit){dispose();new LogInMainFrame().setVisible(true);}else if(e.getSource()==addStuInfor){dispose();new StuInforAdd().setVisible(true);}else if(e.getSource()==searchStuInfor){dispose();new StuInforSearch().setVisible(true);}else if(e.getSource()==searchTeaInfor){dispose();new TeaInforSearch().setVisible(true);}else if(e.getSource()==searchCourseInfor){dispose();new CourseInforSearch().setVisible(true);}else if(e.getSource()==searchMajorInfor){dispose();new DeptInforSearch().setVisible(true);}else if(e.getSource()==searchStuScore){dispose();new StuScoreSearch().setVisible(true);}else{JOptionPane.showMessageDialog(this,"学生成绩管理系统\n\n计算机学院\n\n制作者\n\n何霞","帮助",JOptionPane_INFORMA TION_MESSAGE);}}public static void main(String[] args){new StuMainFrame2();}}教师信息查询界面:import java.awt.*;import javax.swing.*;import java.awt.event.*;import java.sql.*;public class TeaInforSearch extends JFrame implements ActionListener { private JPanel jpl;private JLabel modifyTeaInforLab;private JLabel insertTeaIDLab;private JButton searchBtn;private JLabel teaNameLab;private JLabel teaAgeLab;private JLabel teaProLab;private JLabel teaSexLab;private JLabel stuPhoneLab;private ButtonGroup bgp;private JRadioButton man;private JRadioButton women;private JTextField teaAgeTxt;private JTextField teaProTxt;private JTextField teaIDTxt;private JTextField teaNameTxt;private JTextField teaPhoneTxt;private JButton restBtn;private JButton cancelBtn;private JLabel labeln;private ImageIcon icon;public Connection con;public Statement sql;public ResultSet rs;public String driverName; // 加载JDBC驱动public String dbURL; // 连接服务器和数据库samplepublic String userName; // 默认用户名public String userPwd; // 密码public TeaInforSearch() {super("查询教师信息");driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; // 加载JDBC驱动dbURL = "jdbc:sqlserver://STONE-PC\\SQLEXPRESS:1433; DatabaseName=D01hexia";userName="何霞";userPwd = "828"; // 密码labeln = new JLabel();icon = new ImageIcon("src/images/3.jpg");labeln.setIcon(icon);labeln.setBounds(0, 0,580,500);setSize(labeln.getWidth(), labeln.getHeight());jpl = new JPanel();modifyTeaInforLab = new JLabel("查询教师信息", JLabel.CENTER);insertTeaIDLab = new JLabel("请输入教师编号:", JLabel.CENTER);teaNameLab = new JLabel("教师姓名:", JLabel.CENTER);teaSexLab = new JLabel("教师性别:", JLabel.CENTER);teaAgeLab = new JLabel("教师年龄:", JLabel.CENTER);teaProLab = new JLabel("职称:", JLabel.CENTER);stuPhoneLab = new JLabel("联系电话:", JLabel.CENTER);bgp = new ButtonGroup();man = new JRadioButton("男");women = new JRadioButton("女");teaAgeTxt = new JTextField();teaProTxt = new JTextField();teaIDTxt = new JTextField();teaNameTxt = new JTextField();teaPhoneTxt = new JTextField();searchBtn = new JButton("查询");restBtn = new JButton("重置");cancelBtn = new JButton("取消");// this.setSize(560, 460);this.setVisible(true);this.setResizable(false);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.add(jpl);jpl.setLayout(null);jpl.setBackground(Color.cyan);man.setBackground(Color.cyan);women.setBackground(Color.cyan);searchBtn.setBounds(120, 100, 90, 20);restBtn.setBounds(230, 100, 90, 20);cancelBtn.setBounds(340, 100, 90, 20);modifyTeaInforLab.setBounds(100, 20, 300, 20); insertTeaIDLab.setBounds(100, 60, 110, 20); teaNameLab.setBounds(100, 150, 70, 20);teaSexLab.setBounds(100, 190, 70, 20);teaAgeLab.setBounds(100, 230, 70, 20);teaProLab.setBounds(100, 260, 80, 20); stuPhoneLab.setBounds(100, 290, 70, 20);man.setBounds(205, 190, 60, 20);women.setBounds(285, 190, 60, 20);teaIDTxt.setBounds(220, 60, 140, 20);teaNameTxt.setBounds(190, 150, 140, 20);teaAgeTxt.setBounds(190, 230, 140, 20);teaProTxt.setBounds(190, 260, 140, 20); teaPhoneTxt.setBounds(190, 290, 140, 20); setLocationRelativeTo(null);jpl.add(modifyTeaInforLab);jpl.add(insertTeaIDLab);jpl.add(teaIDTxt);jpl.add(searchBtn);jpl.add(restBtn);jpl.add(cancelBtn);jpl.add(teaNameLab);jpl.add(teaNameTxt);jpl.add(teaAgeLab);jpl.add(teaAgeTxt);jpl.add(teaProLab);jpl.add(teaProTxt);jpl.add(teaSexLab);bgp.add(man);bgp.add(women);jpl.add(man);jpl.add(women);jpl.add(stuPhoneLab);jpl.add(teaPhoneTxt);jpl.add(labeln);teaNameTxt.setEditable(false);teaAgeTxt.setEditable(false);teaProTxt.setEditable(false);teaPhoneTxt.setEditable(false);man.setEnabled(false);women.setEnabled(false);searchBtn.addActionListener(this);restBtn.addActionListener(this);cancelBtn.addActionListener(this);}public void actionPerformed(ActionEvent e) {if (e.getSource() == cancelBtn) {LogInMainFrame log = new LogInMainFrame();log.setVisible(false);if (log.getCurrentUser().equals("teacher")) {dispose();new TeaMainFrame2().setVisible(true);} else {dispose();new StuMainFrame2().setVisible(true);}} else if (e.getSource() == searchBtn) {if (teaIDTxt.getText().toString().equals("")) {JOptionPane.showMessageDialog(null, "请输入教师编号!", "温馨提示",RMA TION_MESSAGE);} else {try {Class.forName(driverName);} catch (ClassNotFoundException se) {}try {con = DriverManager.getConnection(dbURL, userName, userPwd);sql = con.createStatement();rs = sql.executeQuery("select * from Teachers_Hx where Tno_hx='"+ teaIDTxt.getText() + "'");if (rs.next()) {teaIDTxt.setText(rs.getString("Tno_hx"));teaNameTxt.setText(rs.getString("Tname_hx"));teaAgeTxt.setText(rs.getString("Tage_hx").toString());teaProTxt.setText(rs.getString("Tposi_hx"));teaPhoneTxt.setText(rs.getString("Ttele_hx"));if (rs.getString("Tsex_hx").equals("男")) {man.setSelected(true);} else {women.setSelected(true);}teaPhoneTxt.setText(rs.getString("Ttele_hx"));} else {JOptionPane.showMessageDialog(null, "不存在该记录!", "温馨提示",RMA TION_MESSAGE);teaAgeTxt.setText("");teaProTxt.setText("");teaIDTxt.setText("");teaNameTxt.setText("");teaPhoneTxt.setText("");teaIDTxt.requestFocus();teaNameTxt.setEditable(false);teaAgeTxt.setEditable(false);teaProTxt.setEditable(false);teaPhoneTxt.setEditable(false);man.setEnabled(false);women.setEnabled(false);}} catch (SQLException se) {}}} else if (e.getSource() == restBtn) {teaAgeTxt.setText("");teaProTxt.setText("");teaIDTxt.setText("");teaNameTxt.setText("");teaPhoneTxt.setText("");man.setEnabled(false);women.setEnabled(false);}}public static void main(String[] args) {new TeaInforSearch();}}教师信息修改界面:import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.sql.*;public class TeaInforFormAdd extends JFrame implements ActionListener { private JLabel addBasicInfor;private JLabel teaIDLab;private JLabel teaAgeLab;private JLabel teaNameLab;private JLabel teaProLab;private JLabel teaPhoneLab;private JLabel teaSexLab;private JLabel teaPwd;private JTextField txtTeaName;private JTextField txtTeaPro;private JTextField txtTeaID;private JTextField txtTeaAge;private JTextField txtTeaPhone;private JTextField txtTeaPwd;private ButtonGroup bgp;private JRadioButton man;private JRadioButton women;private JButton btnAdd;private JButton btnCancel;private JButton btnReset;private JPanel jpl;private JLabel label;private ImageIcon icon;public Connection con;public Statement sql;public ResultSet rs;public String driverName; // 加载JDBC驱动public String dbURL; // 连接服务器和数据库samplepublic String userName; // 默认用户名public String userPwd; // 密码public TeaInforFormAdd() {super("添加学生信息");driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; // 加载JDBC驱动dbURL = "jdbc:sqlserver://localhost:1433; DatabaseName=C01luolaiyuan"; // 连接服务器和数据库sample// userName// =// "sa";// //// 默认用户名userPwd = "123456"; // 密码label = new JLabel();icon = new ImageIcon("src/images/3.jpg");label.setIcon(icon);label.setBounds(0, 0, 580,500);setSize(label.getWidth(), label.getHeight());jpl = new JPanel(); // 创建面板对象addBasicInfor = new JLabel("添加基本信息", JLabel.CENTER);teaIDLab = new JLabel("教师编号:", JLabel.CENTER);teaAgeLab = new JLabel("教师年龄:", JLabel.CENTER);teaNameLab = new JLabel("教师姓名:", JLabel.CENTER);teaProLab = new JLabel("职称:", JLabel.CENTER);teaPhoneLab = new JLabel("联系电话:", JLabel.CENTER);teaSexLab = new JLabel("教师性别:", JLabel.CENTER); teaPwd = new JLabel("登陆密码:", JLabel.CENTER); txtTeaName = new JTextField(20);txtTeaPro = new JTextField(18);txtTeaID = new JTextField(20);txtTeaAge = new JTextField(20);txtTeaPhone = new JTextField(20);txtTeaPwd = new JPasswordField(null, 20);bgp = new ButtonGroup();man = new JRadioButton("男");women = new JRadioButton("女");btnAdd = new JButton("添加");btnCancel = new JButton("返回");btnReset = new JButton("重置");this.setResizable(false);this.setVisible(true);this.setLocation(300, 300);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.add(jpl);jpl.setLayout(null);jpl.setBackground(Color.green);man.setBackground(Color.green);women.setBackground(Color.green);addBasicInfor.setBounds(100, 20, 300, 20);teaIDLab.setBounds(100, 50, 70, 20);txtTeaID.setBounds(190, 50, 140, 20);teaNameLab.setBounds(100, 90, 70, 20); txtTeaName.setBounds(190, 90, 140, 20);teaSexLab.setBounds(110, 130, 70, 20);man.setBounds(190, 130, 60, 20);women.setBounds(270, 130, 60, 20);teaAgeLab.setBounds(100, 170, 70, 20);txtTeaAge.setBounds(190, 170, 140, 20);teaProLab.setBounds(100, 200, 70, 20);txtTeaPro.setBounds(190, 200, 140, 20); teaPhoneLab.setBounds(100, 230, 70, 20); txtTeaPhone.setBounds(190, 230, 140, 20);teaPwd.setBounds(100, 260, 70, 20);txtTeaPwd.setBounds(190, 260, 140, 20);btnReset.setBounds(80, 350, 90, 20);btnAdd.setBounds(200, 350, 90, 20);btnCancel.setBounds(320, 350, 90, 20);jpl.add(addBasicInfor);jpl.add(teaIDLab);jpl.add(txtTeaID);jpl.add(teaNameLab);jpl.add(txtTeaName);jpl.add(teaSexLab);jpl.add(man);jpl.add(women);bgp.add(man);bgp.add(women);jpl.add(teaAgeLab);jpl.add(txtTeaAge);jpl.add(teaProLab);jpl.add(txtTeaPro);jpl.add(teaPhoneLab);jpl.add(txtTeaPhone);jpl.add(teaPwd);jpl.add(txtTeaPwd);jpl.add(btnReset);jpl.add(btnAdd);jpl.add(btnCancel);jpl.add(label);btnAdd.addActionListener(this);btnReset.addActionListener(this);btnCancel.addActionListener(this);setLocationRelativeTo(null);}public void actionPerformed(ActionEvent e) {if (e.getSource() == btnCancel) {dispose();new TeaMainFrame2().setVisible(true);} else if (e.getSource() == btnAdd) {if (txtTeaID.getText().toString().equals("")) {JOptionPane.showMessageDialog(null, "请输入学号!", "温馨提示",RMA TION_MESSAGE);} else if (txtTeaName.getText().toString().equals("")) {JOptionPane.showMessageDialog(null, "请输入姓名!", "温馨提示",RMA TION_MESSAGE);} else if (txtTeaAge.getText().toString().equals("")) {JOptionPane.showMessageDialog(null, "请输入年龄!", "温馨提示",RMA TION_MESSAGE);} else if (txtTeaPro.getText().toString().equals("")) {JOptionPane.showMessageDialog(null, "出生日期!", "温馨提示",RMA TION_MESSAGE);} else if (txtTeaPhone.getText().toString().equals("")) {JOptionPane.showMessageDialog(null, "请输入专业!", "温馨提示",RMA TION_MESSAGE);} else if (txtTeaPwd.getText().toString().equals("")) {JOptionPane.showMessageDialog(null, "请输入登录密码!", "温馨提示",RMA TION_MESSAGE);} else {String sex;if (man.isSelected()) {sex = "男";} else {sex = "女";}try {Class.forName(driverName);} catch (ClassNotFoundException ce) {JOptionPane.showMessageDialog(null, ce.getMessage());}try {con = DriverManager.getConnection(dbURL, userName, userPwd);sql = con.createStatement();int a = sql.executeUpdate("insert into 教师(教师编号,教师姓名,教师性别,教师年龄, 职称,联系电话)values('"+ txtTeaID.getText()+ "','"+ txtTeaName.getText()+ "','"+ sex+ "','"+ Integer.parseInt(txtTeaAge.getText())+ "','"+ txtTeaPro.getText()+ "','"+ txtTeaPwd.getText() + "')");if (a == 1) {JOptionPane.showMessageDialog(null, "已成功添加", "温馨提示",RMA TION_MESSAGE);} else {JOptionPane.showMessageDialog(null, "添加失败", "温馨提示",RMA TION_MESSAGE);}sql.close();} catch (SQLException se) {JOptionPane.showMessageDialog(null, se.getMessage());}}} else if (e.getSource() == btnReset) {txtTeaPhone.setText("");txtTeaName.setText("");txtTeaPro.setText("");txtTeaID.setText("");txtTeaAge.setText("");txtTeaPwd.setText("");txtTeaID.requestFocus();}}public static void main(String[] args) {new TeaInforFormAdd();}}教师查询学生成绩界面:import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.*;import javax.swing.*;import java.awt.event.*;import javax.swing.*;public class TeaSeaScore extends JFrame implements ActionListener {JList listNames = new JList();public String driverName;// 加载JDBC驱动。
学生成绩管理程序

合肥学院计算机科学与技术系课程设计报告2012~2013学年第二学期课程JA V A语言课程设计课程设计名称学生成绩管理程序学生姓名高昌发学号1104013036专业班级11级计本3班指导教师谭明、张艳明2 0 13 年1 月一、设计目的通过课程设计,学生在下述各方面的能力应该得到锻炼:(1)进一步巩固、加深学生所学专业课程《JAVA语言教程》的基本理论知识,理论联系实际,进一步培养学生综合分析问题,解决问题的能力。
(2)全面考核学生所掌握的基本理论知识及其实际业务能力,从而达到提高学生素质的最终目的。
(3)利用所学知识,开发小型应用系统,掌握运用JAVA语言编写调试应用系统程序,训练独立开发应用系统,进行数据处理的综合能力。
(4)对于给定的设计题目,如何进行分析,理清思路,并给出相应的数学模型。
(5)熟练掌握JAVA语言的事件处理、图形界面、数据库操作等方面的知识。
一、课程设计名称及内容课程设计名称:学生成绩管理程序设计内容:设计一个程序来使用数据库存储学生成绩,进行学生成绩管理程序。
二、任务和要求这是一个简单的使用数据库存储学生成绩的学生成绩管理程序。
数据库中的每条记录包括学号、姓名、生日、分数等信息。
要求能够:(1)有较好的图形界面(2)按照学号查找学生及成绩、能显示全部记录。
(3)能增加、删除、修改记录。
三、详细设计过程该程序使用JDBC-ODBC桥与数据库连接,主要定义:主类和操作类。
主类的主要功能是提供等待用户的操作的主界面(菜单)。
操作类中定义与数据库的连接、提供各种操作界面(增、删、改及统计等操作)。
1、设计的是学生成绩管理程序的界面,如下所示:这个登陆界面的登陆号和密码都已经设计好了,只需要点击登陆则可以进入具体的管理程序。
如果登陆号和密码发生改变则会显示错误提示,具体的子程序代码如下:public class chengjiguanli {public static void main(String[] args) {new denglu();}}/** *登录界面*/@SuppressWarnings("serial")class denglu extends JFrame implements ActionListener {JFrame frame = new JFrame("登陆界面");JPanel imagePanel;ImageIcon bg;JButton button1, button2;Label l1, l2, l3;TextField a1, a2;Box b1, b2, b3, b4, b5;denglu() {Toolkit kit = Toolkit.getDefaultToolkit();Image img = kit.getImage("tubiao.jpg");frame.setIconImage(img);button1 = new JButton("登陆");button2 = new JButton("退出");Panel p1 = new Panel();l1 = new Label("学生成绩管理系统", Label.CENTER);l1.setFont(new Font("隶书", Font.BOLD, 40));l1.setBackground(Color.pink);p1.add(l1);l2 = new Label("登录名");l3 = new Label("密码");a1 = new TextField(10);a2 = new TextField(10);a2.setEchoChar('*');b1 = Box.createVerticalBox();b1.add(l2);b1.add(Box.createVerticalStrut(8));b1.add(l3);b2 = Box.createVerticalBox();b2.add(a1);b2.add(Box.createVerticalStrut(8));b2.add(a2);b3 = Box.createHorizontalBox();b3.add(b1);b3.add(Box.createHorizontalStrut(10));b3.add(b2);b4 = Box.createHorizontalBox();b4.add(button1);b4.add(Box.createHorizontalStrut(10));b4.add(button2);b5 = Box.createVerticalBox();b5.add(b3);b5.add(Box.createVerticalStrut(8));b5.add(b4);button1.addActionListener(this);button2.addActionListener(this);a1.setText("shanshan");a2.setText("shanshan");addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {dispose();}});bg = new ImageIcon("dlu.jpg");JLabel label = new JLabel(bg);label.setBounds(0, 0, bg.getIconWidth(), bg.getIconHeight());imagePanel = (JPanel) frame.getContentPane();imagePanel.setOpaque(false);imagePanel.setLayout(new FlowLayout());imagePanel.add(p1, BorderLayout.NORTH);imagePanel.add(b5, BorderLayout.CENTER);frame.getLayeredPane().setLayout(null);frame.getLayeredPane().add(label, new Integer(Integer.MIN_VALUE));frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setSize(bg.getIconWidth(), bg.getIconHeight());frame.setBounds(200, 150, 510, 340);frame.setResizable(false);//设置窗口大小不可改变frame.setVisible(true);validate();}public void actionPerformed(ActionEvent e) {if (e.getSource() == button2) {System.exit(0);}if (e.getSource() == button1) {if (a1.getText().equals("shanshan") &&a2.getText().equals("shanshan")) {new chuangkou();frame.dispose();} else {JOptionPane.showMessageDialog(this, "账户密码错误,请重新输入!");}}}}2、点击界面的登陆按钮后会出现选择窗口,分别有六个功能:添加、删除、修改、查询、返回、退出。
学生成绩在线管理系统数据库课程设计mysql+java

学生成绩在线管理系统数据库课程设计mysql+java以下是一个学生成绩在线管理系统的数据库设计示例,使用MySQL数据库和Java 编程语言:1. 学生表(students)-学生ID(student_id):主键,自增-学生姓名(student_name):varchar类型,最大长度为50-学生年龄(student_age):整数类型-学生性别(student_gender):varchar类型,最大长度为10-学生班级(student_class):varchar类型,最大长度为502. 课程表(courses)-课程ID(course_id):主键,自增-课程名称(course_name):varchar类型,最大长度为503. 成绩表(scores)-成绩ID(score_id):主键,自增-学生ID(student_id):外键,关联到学生表的学生ID-课程ID(course_id):外键,关联到课程表的课程ID-分数(score):浮点数类型通过以上表的设计,你可以实现以下功能:-添加学生信息-添加课程信息-添加学生成绩-查询学生信息-查询课程信息-查询学生的成绩-更新学生信息-更新课程信息-更新学生成绩-删除学生信息-删除课程信息-删除学生成绩在Java中,你可以使用JDBC(Java Database Connectivity)来连接MySQL数据库并执行SQL语句来实现对数据库的操作。
你需要配置数据库连接信息,并编写相应的Java代码来执行查询和更新操作。
这只是一个简单的数据库设计示例,你可以根据你的具体需求进行调整和扩展。
学生成绩查询系统

学生成绩查询本题编程实现对学生成绩查询,主要实现一个JSP+JavaBean开发模式,要求:编写一个JavaBean 对数据库实现连接、查询、关闭等功能。
使用MS SQL Server 2005本题使用的数据库名称为:Query_Score。
表的名称为:student表结构:字段名称数据类型备注stu_id varchar(15) 学号stu_name varchar(20) 姓名Java_score int 成绩J2EE_score int 成绩Software_score int 成绩表内容:图1(1) 编写对数据库进行操作的JavaBeanpackage com.database;import java.sql.*;public class MyDbBean{private Statement stmt = null;ResultSet rs = null;private Connection conn = null;private String dsn;//构造函数public MyDbBean() { }//根据dsn参数,加载驱动程序,建立连接public void getConn(String dbname, String uid, String pwd) throws Exception{try{dsn = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=" +dbname;Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();conn = DriverManager.getConnection(dsn, uid, pwd);}catch (Exception ex){ System.err.println("aq.executeQuery: " + ex.getMessage()); } }//执行查询类的SQL语句,有返回集public ResultSet executeQuery1(String sql){rs = null;try{ stmt = conn.createStatement(); rs =stmt.executeQuery(sql); }catch(SQLException ex){ System.err.println("aq.executeQuery:"+ex.getMessage()); }return rs;}//关闭对象public void closeStmt(){ try{ stmt.close(); }catch(SQLException ex){ System.err.println("aq.executeQuery: " + ex.getMessage()); } }public void closeConn(){try{ conn.close(); }catch(SQLException ex){ System.err.println("aq.executeQuery: " +ex.getMessage()); } } }(2) 编写按姓名查询成绩的界面图2<body> <center> <fieldset><legend a="center">学生成绩查询系统</legend><form action="queryscore.jsp"method="post" name="queryForm" >姓名:<input type="text" name="xuehao"><input type="submit" value="查询"></form> </fieldset> </center> </body> (3) 接收从图2中输入姓名,单击查询后,得到如下结果:<body><jsp:useBean id="query" scope="session" class="com.database.MyDbBean"/><%! String stu_name,sql; %><%stu_name=request.getParameter("xuehao").trim();if(stu_name==null){ stu_name=null;}byte b[]=stu_name.getBytes("ISO-8859-1");stu_name=new String(b,"UTF-8");//调用getConn()方法与数据库建立连接query.getConn("Query_Score","sa","");sql="select * from student where stu_name='" +stu_name+ "'";ResultSet rs=query.executeQuery1(sql);out.print("<table border align=center>");out.print("<tr>");out.print("<th width=100>"+"学号"+"</th>");out.print("<th width=100>"+"姓名"+"</th>");out.print("<th width=50>"+"Java成绩"+"</th>");out.print("<th width=50>"+"J2EE成绩"+"</th>");out.print("<th width=50>"+"软件成绩"+"</th>");out.print("</tr>");while(rs.next()){ out.print("<tr align=center>");out.print("<td>"+rs.getString(1)+"</td>");out.print("<td>"+rs.getString(2)+"</td>");out.print("<td>"+rs.getInt(3)+"</td>");out.print("<td>"+rs.getInt(4)+"</td>");out.print("<td>"+rs.getInt(5)+"</td>");out.print("</tr>");}rs.close();query.closeStmt();query.closeConn();%></body>学生成绩查询系统使用JSP、servlet以及JavaBean来实现学生成绩查询系统。
AVA连接sqlserver学生成绩管理系统
《学生成绩管理系统》课程设计实验报告题目学生成绩管理系统学院数学与信息工程学院专业计算机科学与技术班级同组成员编写日期一、课程设计目的做这个小的学生成绩管理系统来加深对JAVA所学知识的巩固,以及学习JAVA与数据库的连接和JAVA的GUI图形界面。
二、需求分析此系统实现如下系统功能:(1)使得学生的成绩管理工作更加清晰、条理化、自动化。
(2)通过用户名和密码登录系统,查询学生基本资料,学生所学课程成绩,等功能。
容易地完成学生信息的查询操作。
(3) 设计人机友好界面,功能安排合理,操作使用方便,并且进一步考虑系统在安全性,完整性,并发控制,备份和恢复等方面的功能要求。
三、系统模块设计此系统可分为2个模块,教师管理模块和学生操作模块,期中教师又包括学生信息输入与学生成绩录入等;学生模块则包括学生成绩查询与学生信息录入查询操作等。
1Class Char(10) ————班级Collage Char(10) ————学院2、教师表Field Type Null Key CommentID Varchar(10) ——PRI 用户名Pwd Varchar(10) ————密码3、成绩表Field Type Null Key CommentSid char(10) ——PRI 学号计算机网络char(10) ————课程Linux操作系统char(10) ————课程计算机专业英语char(10) ————课程计算机信息技术char(10) ————课程Java程序设计char(10) ————课程数据库应用实训char(10) ————课程高等数学char(10) ————课程XML char(10) ————课程五、E-R图六、心得体会通过本次课程设计,成功的完成了这个小型简单的系统的设计,在整个设计过程中我对JAVA使用和它强大的作用有了一个更深刻的认识,尽管这个系统很简单,但是它让我综合运用了这个学期所学的JAVA的很多内容,在此基础上,对JAVA的基础知识得到了更好的巩固。
数据库课程设计--java+sql-server--学生管理系统
课程设计任务书题目:学生管理系统学姓专课号名业程信息科学与工程学院数据库技术与应用指导教师职称讲师完成时间:2011年06 月----2010 年07 月枣庄学院计算机科学系制目录1学生信息管理系统概述 (5)1.1系统的任务 (5)1.2系统的目标 (5)2系统具体需求分析 (6)2.1系统需求 (6)2.2数据字典 (6)2.3数据流图 (10)3概念结构设计 (11)4.逻辑结构设计 (14)5.物理结构设计 (15)表汇总 (15)表A—F (16)6.数据保护设计 (18)6.1防止用户直接操作数据库的方法 (18)6.2用户帐号密码的加密方法 (18)6.3角色与权限 (18)7.运行管理与维护说明 (19)8.SQL语句及部分关键JAVA语句 (20)9.心得与体会 (29)8.参考资料 (29)课程设计任务书及成绩评定课程设计的任务和具体要求数据库应用课程设计是计算机技术专业重要的实践课程之一,是在掌握程序设计语言的基础上,学习《数据库原理》课程后的一次综合实践练习。
通过本课程设计,将在课堂上了解和掌握的数据库原理以及设计阶段的方法与技术,直接运用到实际系统的开发工作中。
并且在项目小组长及成员间的合作和沟通中,体验软件项目管理技能和方法,熟悉软件工具与环境。
本次课程设计要求我们小组成员间加强团队合作和沟通,同时每个成员承担明确的责任,独立按时完成相应任务;按照模版完成相应的文档,语言简洁、通顺,开发的系统功能符合需求规格,并能够准确、稳定地运行。
日期:指导教师签字:指导教师评语成绩:指导教师签字:日期:需求分析:1、学生信息管理系统概述学生信息管理系统主要用来管理学生基本信息。
本系统是一个简单的学生信息管理系统,系统管理的信息主要是学生基本信息、课程信息和学生选课信息。
系统的目的是有效地处理这些信息,同时为用户提供信息检索、信息修改和保护功能。
1.1 系统的任务学生信息管理系统是学校有效管理学生的重要工具,它的任务主要有以下几项:◆◆◆◆◆学生基本信息管理,主要负责管理学生基本信息。
基于JAVA的学生成绩管理系统的设计与实现(含源文件)
基于JAVA的学生成绩管理系统的设计与实现摘要:本文按照目前流行的B/S体系结构模式,结合现有的学生成绩管理系统的现状,采用SQL Server 2000数据库和JAVA技术,设计开发了学生成绩管理系统系统,本系统分为前台页面和后台管理两大部分,主要实现成绩查询、成绩删除、成绩添加、成绩修改四大主体功能。
在细节方面,着重考虑了用户添加成绩、成绩查询两方面的简易操作,力求为客户带来方便。
关键词:B/S模式;JA V A;SQL ServerAbstract:This according to the popular B / S architecture model, combined with the current status of student achievement management system using SQL Server 2000 database and JAVA technology, design and development of student achievement management system, the system is divided into front page and back office management two parts, the main accomplishment query results to delete, add scores, results modify the four main functions. In detail, the focus to consider the user to add results, performance query both easy to operate, and strive to bring convenience for customers.Key words:B/S mode;JA V A;SQL Server近年来,随着高校的扩招,运用常规的方法对学生成绩的管理变得越来越困难,因此学校迫切的需要一种高效的系统来帮助其管理学生的成绩。
学生成绩管理系统(JAVA课程设计)
Java课程设计课题:学生成绩管理系统一、问题及功能分析1、身份验证,和使用系统的权限设置、判定。
2、实现同学的学号、性别、成绩等信息的录入、编辑3、提供对学号或姓名,进行成绩或所有信息的查询.4、计算学生平均成绩,显示最高成绩学生信息5、能实现按成绩、学号、姓名排序列出学生信息.6、能统计学生成绩分数段的分布(60以下、60~70、70~80、80~90、90~100)情况,并输出。
7、用文件保存数据,以便反复使用.二、概要设计import java。
lang.*;import java.io。
*;class Mytest{public static void main(String[]args)throws IOException{{int select;select = 1;Student stu[]= new Student[10];StudentMis mis=new StudentMis();Scanner sc = new Scanner(System.in);System。
out.println();System.out。
println(”—---—-—-————————-——-——-——-—---—--———-——");System.out。
println(”* *");System。
out.println(”欢迎进入学生成绩管理系统");System。
out。
println(”**”);System。
out.println(”-————--——-—-—---——-——--———-—-—----——--—");while(true){System。
out.println( );System。
out.println(" 请选择您的操作:");System.out.println(” 1.录入学生成绩信息;”);System.out.println(" 2.显示学生成绩信息;”);System。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
《学生成绩管理系统》课程设计实验报告题目学生成绩管理系统学院数学与信息工程学院专业计算机科学与技术班级同组成员编写日期一、课程设计目的做这个小的学生成绩管理系统来加深对JAVA所学知识的巩固,以及学习JAVA与数据库的连接和JAVA的GUI图形界面。
二、需求分析此系统实现如下系统功能:(1)使得学生的成绩管理工作更加清晰、条理化、自动化。
(2)通过用户名和密码登录系统,查询学生基本资料,学生所学课程成绩,等功能。
容易地完成学生信息的查询操作。
(3)设计人机友好界面,功能安排合理,操作使用方便,并且进一步考虑系统在安全性,完整性,并发控制,备份和恢复等方面的功能要求。
三、系统模块设计此系统可分为2个模块,教师管理模块和学生操作模块,期中教师又包括学生信息输入与学生成绩录入等;学生模块则包括学生成绩查询与学生信息录入查询操作等。
系统流程图:1Sex Char(10)————性别Class Char(10)————班级Collage Char(10)————学院2、教师表Field Type Null Key CommentID Varchar(10——PRI用户名)————密码Pwd Varchar(10)3、成绩表Field Type Null Key CommentSid char(10)——PRI学号计算机网络char(10)————课程Linux操作系统char(10)————课程计算机专业英语char(10)————课程计算机信息技术char(10)————课程Java程序设计char(10)————课程数据库应用实训char(10)————课程高等数学char(10)————课程XML char(10)————课程五、E-R图六、心得体会通过本次课程设计,成功的完成了这个小型简单的系统的设计,在整个设计过程中我对JAVA使用和它强大的作用有了一个更深刻的认识,尽管这个系统很简单,但是它让我综合运用了这个学期所学的JAVA的很多内容,在此基础上,对JAVA的基础知识得到了更好的巩固。
在制作的过程中我也学到很多思想:首先,要学会统筹全局,合理规划,例如在制作整个框架的时候提前就要做全面考虑,要把整个结构图画出来,并且要对数据库表里的东西做全面规划。
同时在编写程序的时候也要想好先实现什么功能,再实现什么功能,这样做出来的东西才有条理性,更容易实现和理解。
其次,要细心仔细。
Java程序虽然容易理解,但在写的过程中一不留心就会出现错误。
当然出错是在所难免的,与性质有关的错误可以经过思考讨论后进行改正,但如果粗心大意,出现输入上的错误就很难发现和修改,会耽误很多时间。
我认为最大的收获是提高了自己的动手能力。
在平时的上机中大多数是根据书上的思想和布局来写程序的。
这次的课程设计要自己思考自己写,考虑的东西比平时上机考虑的要多的多。
在整个设计过程中写代码不是最难的,最难的是构思和布局。
这次课程设计也是一次很好的实践活动,让我们体会到了java的神奇作用。
附录:源代码1、用户登录界面.*;.*;import.*; publicclassSystemsextendsJFrameimplementsActionListener {staticSystemsss;JPanelpanel=newJPanel();JLabellabel1=newJLabel("输入姓名:");JTextFieldname=newJTextField();JLabellabel2=newJLabel("密码:");JPasswordFieldpwd=newJPasswordField();JButtonEnter=newJButton("登录");JButtonExit=newJButton("退出");Stringurl="E:\\mysql\\";ButtonGroupbgp=newButtonGroup();JRadioButtonstu=newJRadioButton("学生");JRadioButtontch=newJRadioButton("教师");publicSystems(){super("登录系统");(false);JLabelimg=newJLabel(newImageIcon(url));(0,0,500,125);(img);(165,210,70,20);(265,210,70,20);(stu);(tch);(stu);(tch);(150,250,80,20);(270,250,80,20);(this);(this);(Enter);(Exit);(null);(panel);(135,130,100,25);(label1);(265,130,100,25);(name);(135,165,100,25);(label2);(265,165,100,25);(pwd);(100,100,500,350);(true);;}publicvoidactionPerformed(ActionEvente){if()==Enter){Stringusername,password;username=();password=newString());try{}catch(ClassNotFoundExceptionce){(ss,());}if()){try{Connectioncon=("jdbc:odbc:shujuku","sa","");Statementstmt=();ResultSetrs=("select*fromSTU");while()){if("ID").equals(username))if(("Pwd").equals(password))){(ss,"登陆成功");Studentsstu=newStudents();}else{(ss,"登录失败");}}();();}catch(SQLExceptionse){(ss,());}}elseif()){try{Connectioncon=("jdbc:odbc:shujuku","sa","");Statementstmt=();ResultSetrs=("select*fromTCH");while()){if("ID").equals(username))if(("Pwd").equals(password))){(ss,"登陆成功");Teacherstch=newTeachers();}else{(ss,"登录失败");}}}catch(SQLExceptionse){(ss,());}}}else{(0);}}publicstaticvoidmain(String[]args){Systemssys=newSystems();}}2、学生登录界面:.*;.*;import publicclassStudentsextendsJFrameimplementsActionListener{JMenuBarjmb=newJMenuBar();JMenuMessage=newJMenu("信息");JMenuScore=newJMenu("成绩");JMenuItemItem1=newJMenuItem("插入");JMenuItemItem2=newJMenuItem("查询");JMenuItemItem3=newJMenuItem("查询");publicStudents(){super("学生界面");(500,400);(true);(false);;(jmb);(Message);(Score);(Item1);(Item2);(Item3);(this);(this);(this);}publicvoidactionPerformed(ActionEvente){if()==Item1){AddMsgad=newAddMsg();}elseif()==Item2){Serchser=newSerch();}else{Scoreso=newScore();}}publicstaticvoidmain(String[]args){Studentsstu=newStudents();}}3、教师登录界面:.*;.*;import publicclassTeachersextendsJFrameimplementsActionListener {JMenuBarbar=newJMenuBar();JMenumenu1=newJMenu("信息");JMenumenu2=newJMenu("成绩");JMenuItemitem1=newJMenuItem("录入信息");JMenuItemitem2=newJMenuItem("录入成绩");JPaneljpl=newJPanel();publicTeachers(){super("教师界面");(500,300);(false);(true);;(bar);(jpl);(null);(menu1);(menu2);(item1);(item2);(this);(this);}publicvoidactionPerformed(ActionEvente){if()==item1){AddMsgmsg=newAddMsg();}else{Addscoreas=newAddscore();}}publicstaticvoidmain(String[]args){Teacherstch=newTeachers();}}4、学生用户添加界面:.*;.*;import.*; publicclassAddMsgextendsJFrameimplementsActionListener {staticAddMsgs;/*添加学生信息控件*/JPaneljpl=newJPanel();JLabellabel1=newJLabel("添加基本信息",; JLabellabel2=newJLabel("学号:",; JLabellabel3=newJLabel("姓名:",; JLabellabel4=newJLabel("性别:",; JLabellabel5=newJLabel("班级:",; JLabellabel6=newJLabel("学院:",; JTextFieldnum=newJTextField(2); JTextFieldnam=newJTextField(4); ButtonGroupbgp=newButtonGroup(); JRadioButtonman=newJRadioButton("男"); JRadioButtonwomen=newJRadioButton("女"); JTextFieldclas=newJTextField(); JTextFieldscl=newJTextField(); JButtonreset=newJButton("重置"); JButtonaddmsg=newJButton("添加"); publicAddMsg(){super("添加学生信息");(false);(500,400);(true);;(jpl);(null);(this);(this);/*插入面板*/(100,20,300,20);(label1);(100,50,70,20);(label2);(190,50,140,20);(num);(100,90,70,20);(label3);(190,90,140,20);(nam);(100,130,70,20);(label4);(190,130,60,20);(270,130,60,20);(man);(women);(man);(women);(100,170,70,20);(label5);(190,170,140,20);(clas);(100,210,70,20);(label6);(190,210,140,20);(scl);(120,250,90,20);(240,250,90,20);(reset);(addmsg);}publicvoidactionPerformed(ActionEvente){if()==addmsg){Stringsex;if()){sex="男";}else{sex="女";}try{}catch(ClassNotFoundExceptionce){(s,());}try{Connectioncon=("jdbc:odbc:shujuku","sa","");Statementstmt=();Stringstr="insertintoSTU(ID,Pwd,Name,Sex,Class,Collage)values('"+()+"','"+" 123','"+()+"','"+sex+"','"+()+"','"+()+"')";;.*;import.*;publicclassAddscoreextendsJFrameimplementsActionListener{staticAddscoress;JLabel[]label={newJLabel("学号:"),newJLabel("计算机网络:"),newJLabel("Linux 操作系统:"),newJLabel("计算机专业英语:"),newJLabel("计算机信息技术基础:"),newJLabel("Java程序设计:"),newJLabel("数据库应用实训教程:"),newJLabel("高等数学:"),newJLabel("XML:")};JTextField[]txt={newJTextField(),newJTextField(),newJTextField(),newJTextFi eld(),newJTextField(),newJTextField(),newJTextField(),newJTextField(),newJTextF ield()};JButtonadd=newJButton("添加");JButtonreset=newJButton("重置");JPaneljpl=newJPanel();JLabeltitle=newJLabel("添加学生成绩",;Fontf=newFont("黑体",,16);ints=100;publicAddscore(){super("添加学生信息");(false);(500,600);(EXIT_ON_CLOSE);(true);(jpl);(this);(this);(null);(150,40,200,20);(f);;;(title);for(inti=0;i<;i++){label[i].setBounds(100,s,140,20);(label[i]);txt[i].setBounds(260,s,140,20);(txt[i]);s=s+40;}(150,s,80,20);(250,s,80,20);(add);(reset);}publicvoidactionPerformed(ActionEvente){if()==add){try{}catch(ClassNotFoundExceptionce){(ss,());}try{Connectioncon=("jdbc:odbc:shujuku","sa","");Statementstmt=();inta=("insertinto计算机系成绩(SID,计算机网络,Linux操作系统,计算机专业英语,计算机信息技术基础,Java程序设计,数据库应用实训教程,高等数学,Xml)values('"+txt[0].getText()+"','"+txt[1].getText()+"','"+txt[2].getText() +"','"+txt[3].getText()+"','"+txt[4].getText()+"','"+txt[5].getText()+"','"+txt [6].getText()+"','"+txt[7].getText()+"','"+txt[8].getText()+"')");if(a==1){(ss,"添加成功");}else{(ss,"添加失败");}}catch(SQLExceptionse){(ss,());}}else{for(inti=0;i<;i++){txt[i].setText("");txt[0].requestFocus();}}}publicstaticvoidmain(String[]args){Addscoreas=newAddscore();}}6、学生信息查询:.*;.*;import.*; publicclassSerchextendsJFrameimplementsActionListener {/*查询学生信息控件*/staticSerchs;JPaneljpl=newJPanel();JLabelSCH=newJLabel("查询学生信息",;JLabellabel1=newJLabel("请输入学号:",;JButtonserch=newJButton("查询");JLabellabel2=newJLabel("姓名:",;JLabellabel3=newJLabel("班级:",;JLabellabel4=newJLabel("学校:",;JLabellabel5=newJLabel("性别:",;ButtonGroupbgp=newButtonGroup();JRadioButtonman=newJRadioButton("男");JRadioButtonwomen=newJRadioButton("女");JTextFieldnum=newJTextField();JTextFieldnam=newJTextField();JTextFieldclas=newJTextField();JTextFieldscl=newJTextField();JButtonreset=newJButton("重置");publicSerch(){(500,400);(true);(false);;(jpl);(null);(this);(this);/*查询面板*/(100,20,300,20);(SCH);(100,60,100,20);(label1);(220,60,140,20);(num);(120,100,90,20);(260,100,90,20);(serch);(reset);(100,140,70,20);(label2);(190,140,140,20);(nam);(100,180,70,20);(label5);(205,180,60,20);(285,180,60,20);(man);(women);(man);(women);(100,220,70,20);(label3);(190,220,140,20);(clas);(100,260,70,20);(label4);(190,260,140,20);(scl);}publicvoidactionPerformed(ActionEvente){Stringid=();if()==serch){try{}catch(ClassNotFoundExceptionce){(s,());}try{Connectioncon=("jdbc:odbc:shujuku","sa","");Statementstmt=();ResultSetrs=("select*fromSTUwhereID='"+id+"'");while()){("Name"));if("Sex").equals("男")){(true);}else{(true);}("Class"));("Collage"));}}catch(SQLExceptionse){(s,());}}}publicstaticvoidmain(String[]args){Serchsch=newSerch();}}7、学生成绩查询.*;.*;importimport.*;publicclassScoreextendsJFrameimplementsActionListener{staticScores;JLabeltitle=newJLabel("查询成绩",;Fontf=newFont("楷体",+,16);JPaneljpl=newJPanel();JLabellabel1=newJLabel("请输入学号:",;JTextFieldnum=newJTextField();JButtonserch=newJButton("查询成绩");JButtonreset=newJButton("重置");JLabellabel2=newJLabel("计算机网络:",;JLabellabel3=newJLabel("Linux操作系统:",;JLabellabel4=newJLabel("计算机专业英语:",;JLabellabel5=newJLabel("计算机信息技术基础:",;JLabellabel6=newJLabel("Java程序设计:",;JLabellabel7=newJLabel("数据库:",;JLabellabel8=newJLabel("高等数学:",;JLabellabel9=newJLabel("XML:",;JTextField[]txt={newJTextField(),newJTextField(),newJTextField(),newJTextFi eld(),newJTextField(),newJTextField(),newJTextField(),newJTextField()};staticintp=140;publicScore(){super("查询分数");(false);(500,550);(true);;(f);(jpl);(null);(100,20,300,20);(title);(100,60,90,20);(label1);(210,60,140,20);(num);(130,100,90,20);(240,100,90,20);(serch);(reset);(this);(this);(100,140,140,20);(100,180,140,20);(100,220,140,20);(100,260,140,20);(100,300,140,20);(100,340,140,20);(100,380,140,20);(100,420,140,20);(label2);(label3);(label4);(label5);(label6);(label7);(label8);(label9);for(inti=0;i<;i++){txt[i].setBounds(260,p,140,20);(txt[i]);p=p+40;}}publicvoidactionPerformed(ActionEvente) {if()==serch){Stringid=();try{}catch(ClassNotFoundExceptionce){(s,());}try{Connectioncon=("jdbc:odbc:shujuku","sa","");Statementstmt=();ResultSetrs=("select计算机系成绩.*fromSTU,计算机系成绩='"+id+"'=计算机系成绩.SID");while()){for(inti=0;i<;i++){txt[i].setText(i+2));}}}catch(SQLExceptionse){(s,());}}else{for(inti=0;i<;i++){txt[i].setText("");}("");}}publicstaticvoidmain(String[]args){Scores=newScore();}}。