1、AbstractThis article focuses on the student information management system-student module for the development process. Introduced a system for environment and development tools, the design concept and design process has also made a comprehensive narrative, in the database to create ideological and va
2、rious data tables specific links between the areas has also made detailed and specific analysis of the The various functions of the system to achieve process and detailed design process, drawing a simple system function modules map at the same time, to more clearly show that design thinking and the
3、whole process of planning and design of concrete realization.This system has many features: system fully functional, easy to use simple user-friendly user interface, complete security settings, greatly reducing the operators and users of the burden and improve the efficiency of the management of stu
4、dents and school information Level. 1.实验目的: 编写学生信息管理系统程序:(1)基本要求:学生信息(包括学号、姓名、性别、年龄、家庭住址、电话等)的添加,删除,修改,查询(包括按学号,按姓名等查询)。(2)提高要求(依据自身情况自选):可填加班级信息(也可删除、修改班级),学生信息中包含班级信息,可按班级统计学生。简单统计,按性别统计等。说明:此程序要求图形界面实现。2.系统具备的基本功能“学生信息管理系统”学生模块的开发主要包括应用程序系统和后台数据库,应用程序系统要求界面友好,功能完备,易使用等特点。而后台数据库的数据要具有一致性、完整性、安全性。学
5、生操作前台操作方便.前台作为与学生直接交互的界面,在考虑功能的同时,也考虑了操作的简洁和方便性,目的是让大多数不在懂电脑操作的客户,也能轻松的享受计算机给他们带来的便利。前台系统主要具备学生个人信息的查询功能,学生可以查询自个人信息。3.系统学生子功能划分经过对问题分析,学生子系统比较简单,主要完成学生网上课程成绩及个人信息查询的功能及密码修改的功能。学生以学号及密码的身份进行登录,系统功能结构如图:4.学生子系统功能描述1. 学生信息录入模块本模块完成学生个人信息录入功能,进入本模块,学生可以将自己的学号,姓名,性别,年龄,地址等信息录入系统,2. 学生信息查询模块学生的基本信息录入后,可通
6、过这个模块来进行查询。3. 学生信息修改模块 本模块用于日后学生信息有改动时,对学生的信息进行改动,以确保学生信息的正确性,5.设计流程及部分截图import address.sql.*;import address.util.*;public class Student2 private static Scanner scanner =new Scanner(System.in); String driver = org.hsqldb.jdbcDriver; String url = jdbc:hsqldb:hsql:/localhost/连接到本机上默认的数据库 String user=s
7、a String pass= private Connection con; public void init()throws Exception if(con!=null) return; Class.forName(driver); con=DriverManager.getConnection(url,user,pass);/建立和数据库之间的连接 String sql=create table student(id bigint,name varchar(120), sql+=sex decimal,age decimal,address decimal) Statement stmt
8、=con.createStatement(); stmt.executeUpdate(sql);/创建表,只执行一次。/在表中插入数据以备使用 public void close()throws Exception=null) con.close();/*创建student 表,表中有id,name,age,sex,address 五列*/ public void Add() throws Exception System.out.println(请输入学生学号:(当输入学号为-1时停止); long id=scanner.nextLong(); while(id!=-1)请输入该学生的名字:
9、 String name=scanner.next();请连续输入 sex,age,address各科成绩: double sex=scanner.nextDouble(); double age=scanner.nextDouble(); double address=scanner.nextDouble();insert into student values(?,?) PreparedStatement pstmt =con.prepareStatement(sql); pstmt.setLong(1,id); pstmt.setString(2,name); pstmt.setDoub
10、le(3,sex); pstmt.setDouble(4,age); pstmt.setDouble(5,address); pstmt.execute(); pstmt.close(); id=scanner.nextLong();/*查询时使用Statement 的executeQuery 方法,其它用executeUpdate 方法*/ public void dispAll() throws Exception /创建对象,该对象用来执行命令select * from student ResultSet rs=stmt.executeQuery(sql);/执行命令,返回执行结果 if
11、(!rs.next()对不起,该数据库可能还没有创建信息! while(rs.next() String id=rs.getString(id String name=rs.getString(name String age=rs.getString(age String sex=rs.getString(sex String address= rs.getString(address System.out.printf(%s,%s,%s,%s,%s%n,id,name,age,sex,address); rs.close();stmt.close();/*按学号查询学生信息*/ public
12、 void searchByid()throws Exception System.out.print(请输入所要查询的学生的id号: long _id=scanner.nextLong();select*from student where id=+_id+ if(rs.next() long id=rs.getLong( Double age=rs.getDouble( Double sex=rs.getDouble( Double address=rs.getDouble( System.out.println(id+ +name+age+sex+address); else对不起,此学生信息不存在./*按学生姓名查询*/ public void searchByname()throws Exception请输入所要查询的学生的姓名: String _name=scanner.n
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1