• 大小: 754KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-10
  • 语言: 其他
  • 标签: 模板  选课  

资源简介

学生选课系统模板,简单易懂,方便模仿,可供参考

资源截图

代码片段和文件信息

package wsxk;
import java.sql.*;
public class ConDB{


public static Connection init(){
Connection conn = null;
String url = “jdbc:odbc:xuanke“;
//String driverName = “com.mysql.jdbc.Drive“;
//String url = “jdbc:mysql://localhost:3307/xuanke“;
//String user = “root“;
        //String password = “root“;
        
try {
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver“);
try {
//conn= DriverManager.getConnection(urluserpassword);
conn= DriverManager.getConnection(url);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (ClassNotFoundException e) {
             e.printStackTrace();
}
return conn;

}
  



  public ResultSet executeQuery(String sql)
  {
  ResultSet rs = null;
    try {
      rs = null;
      Connection conn= this.init();
      Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVEResultSet.CONCUR_UPDATABLE);
      rs = stmt.executeQuery(sql);
    }
    catch (SQLException ex) {
 System.out.println(“执行错误“);  
 ex.printStackTrace();}
    return rs;
  }


        public void executeUpdate(String strSQL)
        {
                try
                {
                        Connection conn= this.init();
                        Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVEResultSet.CONCUR_UPDATABLE);
                        stmt.executeQuery(strSQL);
                }
                catch(SQLException ex)
                {
                        System.err.println(“连接数据库失败了,异常为:“ +ex.getMessage());
                }
        }

         public String ex_chinese(String str)
         {
                 if(str==null)
                 {
                                str  =““ ;
                 }
                 else
                 {
                           try
                           {
                                         str = new String(str.getBytes(“iso-8859-1“)“gb2312“) ;
                           }
                           catch (Exception ex)
                           {
                                        System.err.println(“异常为:“ +ex.getMessage());
                           }
                 }
                 return str ;
         }

         public String gettime()
         {
                String datestr =  ““ ;
                try
                {
                        java.text.DateFormat df = new java.text.SimpleDateFormat(“yyyy年MM月dd日 HH点ss分“) ;
                        java.util.Date date = new java.util.Date() ;
                        datestr = df.format(new java.util.Date()) ;
                }
                catch (Exception ex)
                {
                        System.err.println(“异常为:“ +ex.getMessage());
                }

                return datestr ;
         }
         public static void main(String args[]){
          ConDB c = new ConDB();
   

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        478  2009-09-03 08:44  NetSelectCourse\.classpath

     文件        318  2009-09-02 23:41  NetSelectCourse\.mymetadata

     文件       1421  2009-09-02 23:47  NetSelectCourse\.project

     文件       2304  2009-09-05 09:49  NetSelectCourse\xuanke.ldb

     文件     290816  2009-09-05 09:19  NetSelectCourse\xuanke.mdb

     文件        500  2009-09-02 23:47  NetSelectCourse\.settings\.jsdtscope

     文件         49  2009-09-02 23:47  NetSelectCourse\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2009-09-02 23:47  NetSelectCourse\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       3064  2009-09-03 12:35  NetSelectCourse\src\wsxk\ConDB.java

     文件       1207  2007-07-31 10:36  NetSelectCourse\src\wsxk\Test.java

     文件      11167  2007-05-17 19:11  NetSelectCourse\WebRoot\admincourse.jsp

     文件       2074  2007-05-11 16:29  NetSelectCourse\WebRoot\admincourse2.jsp

     文件      10977  2007-05-17 19:11  NetSelectCourse\WebRoot\admincourse3.jsp

     文件       2389  2007-05-11 16:29  NetSelectCourse\WebRoot\admincourse4.jsp

     文件       1378  2007-05-11 16:29  NetSelectCourse\WebRoot\admincourse5.jsp

     文件        719  2007-05-11 14:42  NetSelectCourse\WebRoot\admincoursedelerr.htm

     文件        647  2007-05-11 14:42  NetSelectCourse\WebRoot\admincourseerr.htm

     文件       7862  2007-05-17 19:12  NetSelectCourse\WebRoot\adminlyb.jsp

     文件       1115  2007-05-11 16:30  NetSelectCourse\WebRoot\adminlyb2.jsp

     文件      11054  2007-05-17 19:12  NetSelectCourse\WebRoot\adminscore.jsp

     文件       3406  2007-05-11 16:30  NetSelectCourse\WebRoot\adminscore2.jsp

     文件        646  2007-05-11 14:42  NetSelectCourse\WebRoot\adminscoreerr.htm

     文件      11030  2007-05-17 19:13  NetSelectCourse\WebRoot\adminstudent.jsp

     文件       2119  2007-05-11 16:30  NetSelectCourse\WebRoot\adminstudent2.jsp

     文件      11185  2007-05-17 19:13  NetSelectCourse\WebRoot\adminstudent3.jsp

     文件       2454  2007-05-11 16:30  NetSelectCourse\WebRoot\adminstudent4.jsp

     文件       1382  2007-05-11 16:30  NetSelectCourse\WebRoot\adminstudent5.jsp

     文件        720  2007-05-11 14:42  NetSelectCourse\WebRoot\adminstudentdelerr.htm

     文件        654  2007-05-11 14:42  NetSelectCourse\WebRoot\adminstudenterr.htm

     文件       9629  2007-05-17 19:13  NetSelectCourse\WebRoot\admintc.jsp

............此处省略91个文件信息

评论

共有 条评论