资源简介
绝对的好软件,又利于学习者参考,我实现了很多功能。这是本人在就读北大青鸟 做得一个自己认为还不错的程序
代码片段和文件信息
package dao;
import java.sql.*;
import java.util.Vector;
import java.util.Calendar;
//数据库连接类,包含连接及销毁连接的方法
public class DBConn {
private Connection con;
private String url;
private String serverName;
private String portNumber;
private String databaseName;
private String userName;
private String password;
private String sql;
private PreparedStatement s;
private ResultSet rs;
public DBConn() {
url = “jdbc:microsoft:sqlserver://“;
serverName = “localhost“;
portNumber = “1433“;
databaseName = “guanliDB“;
userName = “sa“;
password = “1“;
}
private String getConnectionUrl() {
return “jdbc:odbc:guanli“;
}
private Connection getConnection() {
try {
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver“);
con = DriverManager.getConnection(getConnectionUrl());
} catch (SQLException ex) {
System.out.println(ex);
} catch (ClassNotFoundException ex) {
System.out.println(ex);
}
return con;
}
public boolean myupdate(String sql) {
con = this.getConnection();
try {
s = con.prepareStatement(sql);
if (s.executeUpdate() != 0) {
return true;
}
return false;
} catch (SQLException ex) {
System.out.println(ex);
return false;
} finally {
myclose(con s null);
}
}
public Vector myselect(String sql) {
con = this.getConnection();
try {
Vector vc = new Vector();
s = con.prepareStatement(sql);
rs = s.executeQuery();
int clo = rs.getmetaData().getColumnCount();
while (rs.next()) {
for (int i = 0; i < clo; i++) {
vc.addElement(rs.getString(i + 1));
}
}
return vc;
} catch (SQLException ex) {
System.out.println(ex);
return null;
} finally {
myclose(con s rs);
}
}
public Vector mysearch(String sql) {
con = this.getConnection();
try {
Vector vc = new Vector();
s = con.prepareStatement(sql);
rs = s.executeQuery();
int clo = rs.getmetaData().getColumnCount();
while (rs.next()) {
Vector c = new Vector();
for (int i = 0; i < clo; i++) {
if (i == 3) {
c.addElement(new OperateStuDao().getAgeByBirth(rs.
getString(i +
1).
toString())
);
} else {
c.addElement(rs.getString(i
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4305 2008-07-26 08:55 GradeManager\classes\dao\DBConn.class
文件 2424 2008-07-05 20:34 GradeManager\classes\dao\OperateAdminDao.class
文件 4177 2008-07-05 20:34 GradeManager\classes\dao\OperateBjDao.class
文件 2896 2008-07-05 20:34 GradeManager\classes\dao\OperateCourseDao.class
文件 1710 2008-07-05 20:34 GradeManager\classes\dao\OperateMarkDao.class
文件 7139 2008-07-05 20:34 GradeManager\classes\dao\OperateStuDao.class
文件 2302 2008-07-05 20:34 GradeManager\classes\dao\OperateZyDao.class
文件 1799 2008-07-08 10:47 GradeManager\classes\gui\AboutUsDialog.class
文件 4851 2008-07-08 10:47 GradeManager\classes\gui\AddClassfr
文件 682 2008-07-08 10:47 GradeManager\classes\gui\AddClassfr
文件 4641 2008-07-08 10:47 GradeManager\classes\gui\AddCoursefr
文件 679 2008-07-08 10:47 GradeManager\classes\gui\AddCoursefr
文件 5165 2008-07-08 10:47 GradeManager\classes\gui\AddScorefr
文件 682 2008-07-08 10:47 GradeManager\classes\gui\AddScorefr
文件 7569 2008-07-08 10:47 GradeManager\classes\gui\AddStudentfr
文件 685 2008-07-08 10:47 GradeManager\classes\gui\AddStudentfr
文件 716 2008-07-08 10:47 GradeManager\classes\gui\AddStudentfr
文件 4104 2008-07-08 10:47 GradeManager\classes\gui\AddUserfr
文件 664 2008-07-08 10:47 GradeManager\classes\gui\AddUserfr
文件 730 2008-07-09 15:24 GradeManager\classes\gui\CountScoreDialog$1.class
文件 719 2008-07-09 15:24 GradeManager\classes\gui\CountScoreDialog$2.class
文件 716 2008-07-09 15:24 GradeManager\classes\gui\CountScoreDialog$3.class
文件 712 2008-07-09 15:24 GradeManager\classes\gui\CountScoreDialog$4.class
文件 713 2008-07-09 15:24 GradeManager\classes\gui\CountScoreDialog$5.class
文件 10096 2008-07-09 15:24 GradeManager\classes\gui\CountScoreDialog.class
文件 753 2008-07-08 10:47 GradeManager\classes\gui\CountScoreResultDialog$1.class
文件 3191 2008-07-08 10:47 GradeManager\classes\gui\CountScoreResultDialog.class
文件 707 2008-07-11 03:31 GradeManager\classes\gui\GradeManagerfr
文件 39476 2008-07-11 03:31 GradeManager\classes\gui\GradeManagerfr
文件 709 2008-07-11 03:31 GradeManager\classes\gui\GradeManagerfr
............此处省略183个文件信息
- 上一篇:poi-3.17完整jar包
- 下一篇:图书管理系统(可做课程设计)
评论
共有 条评论