• 大小: 3.56MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-27
  • 语言: Java
  • 标签: jsp  成绩管理  

资源简介

其中包含数据库和完整的jsp成绩管理项目包括:成绩录入,查询,修改等功能。

资源截图

代码片段和文件信息


package classman;
import db.dbconn;
import util.stringUtil;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.sql.ResultSet;
/**
 * 封装对班级表的所有操作
 * @author 邓子云
 */
public class class_operation{
   /**
    * 功能:往班级表增加一条记录
    * 输入参数:class_name为班级名称
    * 输出:返回1表成功,返回2表数据连接参数配置不正确或连接数据库失败或数据库操作失败,
    * 返回3表此班级已存在,返回4表输入参数class_name为空;
    */
   public int class_add_one(String class_name){
       dbconn dbconnobject=new dbconn();//数据库连接对象
       String sqlString=null;//SQL语句字符串
       ResultSet rs=null;//结果记录集
       Connection dbconn=dbconnobject.getDBConn();//得到数据库连接
       if(dbconn==null) return 2;//连接失败
       //--------输入参数不正确---------
       if(class_name==null||class_name.trim().length()==0)
          return 4;
       //--------输入参数编码转换-------
       stringUtil stringCode=new stringUtil();
       class_name=stringCode.codeToString(class_name.trim());
       //--------插入记录,先判断是否已存在------
       sqlString=“select * from class where class_name=?“;
       try{
          PreparedStatement preSQLSelect=dbconn.prepareStatement(sqlString);
          preSQLSelect.setString(1class_name);
          rs=preSQLSelect.executeQuery();
          if(rs.next()) return 3;//已存在此班级
          sqlString=“insert into class(class_name) values(?)“;
          PreparedStatement preSQLInsert=dbconn.prepareStatement(sqlString);
          preSQLInsert.setString(1class_name);
          preSQLInsert.executeUpdate();
          return 1;
        }catch(Exception e){
          System.out.print(e);
          return 2;
        }             
   }
   /**
    * 功能:查询出所有的班级
    * 输入参数:无
    * 输出:所有班级的记录集如果没有记录或操作失败返回null
    */
   public ResultSet class_select_all(){
       String sqlString=null;//SQL语句字符串
       Statement sql=null;//SQL语句对象
       ResultSet rs=null;//结果记录集
       dbconn dbconnobject=new dbconn();//数据库连接对象
       Connection dbconn=dbconnobject.getDBConn();//得到数据库连接
       if(dbconn==null) return null;//连接失败
       try{
          //-------查询出数据------------
          sqlString=“select * from class“; 
          sql=dbconn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE ResultSet.CONCUR_READ_ONLY);
          rs=sql.executeQuery(sqlString);
          return rs;
       }catch(Exception e){
          System.out.print(e);
          return null;
       }  
   }
   /**
    * 功能:删除一个班级的信息
    * 输入参数:班级的ID号
    * 输出:返回1表成功,返回2表数据连接参数配置不正确或连接数据库失败,
    * 返回4表输入参数class_id为0,即输入参数不正确
    */
   public int class_delete(int class_id){
       String sqlString=null;//SQL语句字符串
       ResultSet rs=null;//结果记录集
       dbconn dbconnobject=new dbconn();//数据库连接对象
       Connection dbconn=dbconnobject.getDBConn();//得到数据库连接
       if(dbconn==null) return 2;//连接失败
       if(class_id==0) return 4;//输入参数不正确
       //---------删除数据--------------
       sqlString=“delete from class where class_id=?“;
       try{
           PreparedStatement preSQLDelete=dbco

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-06-15 09:25  chengji\
     目录           0  2012-11-19 09:56  chengji\chengji\
     文件        1054  2012-11-19 10:51  chengji\chengji\.classpath
     目录           0  2014-07-03 11:19  chengji\chengji\.myeclipse\
     文件         294  2012-11-19 09:56  chengji\chengji\.mymetadata
     文件        1225  2007-12-03 10:07  chengji\chengji\.project
     目录           0  2012-11-19 09:56  chengji\chengji\WebRoot\
     目录           0  2012-11-19 09:56  chengji\chengji\WebRoot\meta-INF\
     文件          39  2007-12-03 10:02  chengji\chengji\WebRoot\meta-INF\MANIFEST.MF
     目录           0  2012-11-19 09:56  chengji\chengji\WebRoot\WEB-INF\
     文件       10763  2007-12-03 10:01  chengji\chengji\WebRoot\WEB-INF\c-1_0-rt.tld
     文件       11310  2007-12-03 10:01  chengji\chengji\WebRoot\WEB-INF\c-1_0.tld
     文件       15999  2007-12-03 10:01  chengji\chengji\WebRoot\WEB-INF\c.tld
     目录           0  2012-11-19 10:51  chengji\chengji\WebRoot\WEB-INF\classes\
     目录           0  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\classman\
     文件        3683  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\classman\class_operation.class
     目录           0  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\core\
     文件        8256  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\core\core_operation.class
     目录           0  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\db\
     文件        2264  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\db\dbconn.class
     文件         164  2012-11-19 10:51  chengji\chengji\WebRoot\WEB-INF\classes\dbconn.properties
     目录           0  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\lessionman\
     文件        4340  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\lessionman\classlession_operation.class
     文件        3737  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\lessionman\lession_operation.class
     目录           0  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\pic\
     文件        2208  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\pic\corePieChart.class
     目录           0  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\studentman\
     文件        4752  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\studentman\student_operation.class
     目录           0  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\teacherman\
     文件        4196  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\teacherman\teacher_operation.class
     目录           0  2002-01-01 01:09  chengji\chengji\WebRoot\WEB-INF\classes\teachlessionman\
............此处省略133个文件信息

评论

共有 条评论