欢迎来到三一文库! | 帮助中心 三一文库31doc.com 一个上传文档投稿赚钱的网站
三一文库
全部分类
  • 研究报告>
  • 工作总结>
  • 合同范本>
  • 心得体会>
  • 工作报告>
  • 党团相关>
  • 幼儿/小学教育>
  • 高等教育>
  • 经济/贸易/财会>
  • 建筑/环境>
  • 金融/证券>
  • 医学/心理学>
  • ImageVerifierCode 换一换
    首页 三一文库 > 资源分类 > DOC文档下载  

    java数据库管理系统课程设计-学生信息管理系统 .doc

    • 资源ID:5090021       资源大小:128KB        全文页数:16页
    • 资源格式: DOC        下载积分:4
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录   微博登录  
    二维码
    微信扫一扫登录
    下载资源需要4
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    java数据库管理系统课程设计-学生信息管理系统 .doc

    Java课程设计姓 名:学 号:班 级:学 院:指导教师:目录1. 题目简介2. 程序概要.3. 程序函数简介.4. 源代码5. 运行截图.6. 心得体会.1题目简介题目简介:要求基于数据库管理系统,建立一个学生信息管理系统,有简单的显示、更新、插入等基本功能。还有程序需有窗口,也就是运行界面中要含有窗口。程序尽量简单,但功能得全面,界面做到尽善尽美!2.程序概要程序概要:本程序中含有一个public类,三个一般类。其主函数在public类中,一般类中每个类实现一个功能。在主函数中调用一般类中的函数,实现不同的功能。每个一般类也是建立在窗口上的,其中运用了窗口,组件,按钮,布局等多种知识。3.程序函数简介public static void main(String args ).主函数class DatabaseWin extends JFrame implements ActionListener该类实现主要窗口的建立DatabaseWin().建立窗口,添加窗口组件public void actionPerformed(ActionEvent e).实现监视class InsertRecord extends JDialog implements ActionListener负责插入的类InsertRecord(String s)实现插入功能class ShowRecord extends JDialog implements ActionListener负责显示的类ShowRecord(String title).实现显示功能class ModifyRecord extends JDialog implements ActionListener.责更新的类ModifyRecord(String s).实现更新功能4.源代码import javax.swing.*; import java.awt.*;import java.awt.event.*;import java.sql.*;import javax.swing.border.*;public class Mykcsj public static void main(String args ) try Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); catch(ClassNotFoundException e) System.out.println(""+e); DatabaseWin win=new DatabaseWin(); class DatabaseWin extends JFrame implements ActionListener/主窗口 JMenuBar menubar; JMenu menu; JMenuItem itemShow,itemUpdate,itemInsert; ShowRecord showRecord; ModifyRecord modifyRecord; InsertRecord insertRecord; DatabaseWin() menubar=new JMenuBar(); menu=new JMenu("操作数据库"); itemShow=new JMenuItem("显示记录"); itemUpdate=new JMenuItem("更新记录"); itemInsert=new JMenuItem("插入记录"); itemShow.addActionListener(this); itemUpdate.addActionListener(this); itemInsert.addActionListener(this); menu.add(itemShow); menu.add(itemUpdate); menu.add(itemInsert); menubar.add(menu); showRecord=new ShowRecord("显示记录对话框"); modifyRecord=new ModifyRecord("修改记录对话框"); insertRecord=new InsertRecord("插入记录对话框"); setJMenuBar(menubar); setBounds(100,100,370,250); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); public void actionPerformed(ActionEvent e) if(e.getSource()=itemShow) showRecord.setVisible(true); else if(e.getSource()=itemUpdate) modifyRecord.setVisible(true); else if(e.getSource()=itemInsert) insertRecord.setVisible(true); class InsertRecord extends JDialog implements ActionListener /负责插入记录的类 JLabel hintLabel; Object name="学号","姓名","出生日期","身高" Object a=new Object14; JTable table; JButton enterInsert; Connection con; Statement sql; ResultSet rs; String num; InsertRecord(String s) setTitle(s); hintLabel=new JLabel("输入新记录:"); table=new JTable(a,name); enterInsert=new JButton("插入新记录"); setLayout(null); Box baseBox=Box.createHorizontalBox(); baseBox.add(hintLabel); baseBox.add(new JScrollPane(table); baseBox.add(enterInsert); add(baseBox); baseBox.setBounds(10,40,600,38); enterInsert.addActionListener(this); setBounds(120,160,700,200); public void actionPerformed(ActionEvent e) try con=DriverManager.getConnection("jdbc:odbc:hello","",""); sql=con.createStatement(); int k=sql.executeUpdate ("INSERT INTO message VALUES('"+ a00+"','"+a01+"','"+a02+"','"+a03+"')"); if(k=1) JOptionPane.showMessageDialog (this,"插入记录成功","成功",JOptionPane.PLAIN_MESSAGE); con.close(); catch(SQLException ee) JOptionPane.showMessageDialog (this,"插入记录失败"+ee,"失败",JOptionPane.ERROR_MESSAGE); class ShowRecord extends JDialog implements ActionListener/负责显示记录的类 JTable table; Object a; Object name="学号","姓名","出生日期","身高" JButton showRecord; Connection con; Statement sql; ResultSet rs; ShowRecord(String title) setTitle(title); showRecord=new JButton("显示记录"); showRecord.addActionListener(this); add(showRecord,BorderLayout.NORTH); setBounds(200,60,400,250); public void actionPerformed(ActionEvent e) try con=DriverManager.getConnection("jdbc:odbc:hello","",""); sql=con.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); rs=sql.executeQuery("SELECT * FROM message "); rs.last(); int lastNumber=rs.getRow(); a=new ObjectlastNumber4; int k=0; rs.beforeFirst(); while(rs.next() ak0=rs.getString(1); ak1=rs.getString(2); ak2=rs.getDate(3); ak3=rs.getString(4); k+; con.close(); catch(SQLException ee) System.out.println(ee); table=new JTable(a,name); getContentPane().removeAll(); validate(); add(showRecord,BorderLayout.NORTH); add(new JScrollPane(table),BorderLayout.CENTER); validate(); class ModifyRecord extends JDialog implements ActionListener /负责更新记录的类 JLabel hintLabel; JTextField inputNumber; Object name="姓名","出生日期","身高" Object a=new Object13; JTable table; JButton enterModify; Connection con; Statement sql; ResultSet rs; String num; ModifyRecord(String s) setTitle(s); hintLabel=new JLabel("输入学号(回车确认):"); inputNumber=new JTextField(20); table=new JTable(a,name); enterModify=new JButton("更新记录"); setLayout(null); Box baseBox=Box.createHorizontalBox(); baseBox.add(hintLabel); baseBox.add(inputNumber); baseBox.add(new JScrollPane(table); baseBox.add(enterModify); add(baseBox); baseBox.setBounds(10,40,600,38); inputNumber.addActionListener(this); enterModify.addActionListener(this); setBounds(20,60,700,200); public void actionPerformed(ActionEvent e) if(e.getSource()=inputNumber) try num=inputNumber.getText().trim(); con=DriverManager.getConnection("jdbc:odbc:hello","",""); sql=con.createStatement(); rs=sql.executeQuery("SELECT * FROM message WHERE 学号='"+num+"'"); boolean boo=rs.next(); if(boo=false) JOptionPane.showMessageDialog (this,"学号不存在","提示",JOptionPane.WARNING_MESSAGE); else a00=rs.getString(2); a01=rs.getDate(3).toString(); a02=rs.getString(4); table.repaint(); con.close(); catch(SQLException ee) System.out.println(ee); if(e.getSource()=enterModify) try con=DriverManager.getConnection("jdbc:odbc:hello","",""); sql=con.createStatement(); sql.executeUpdate ("UPDATE message SET 姓名='"+a00+ "',出生日期='"+a01+ "',身高='"+a02+"'WHERE 学号='"+num+"'"); JOptionPane.showMessageDialog (this,"更新成功","成功",JOptionPane.PLAIN_MESSAGE); con.close(); catch(SQLException ee) JOptionPane.showMessageDialog (this,"更新失败"+ee,"失败",JOptionPane.ERROR_MESSAGE); 5.运行截图插入前:插入后:更新前:更新后:7. 设计心得其实这次课程设计相对于前几次的课程设计相对容易的多,因为我们刚学完就开始做这个,所以很多东西都很清楚。但是作为一个课程设计,也有很多难点。刚开始写的时候很顺利,但随着功能得加大,越来越多的东西需要我去查资料,问同学,问老师。这次课程设计大概耗时半个月,设计结果自己还算满意。这次课程设计虽然花了很多时间,但也学到了很多东西。这就是课程设计的目的,我想我已经做到,也已经深深体会到了.

    注意事项

    本文(java数据库管理系统课程设计-学生信息管理系统 .doc)为本站会员(yyf)主动上传,三一文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    经营许可证编号:宁ICP备18001539号-1

    三一文库
    收起
    展开