资源简介
自己做的学校用的自习室查询系统,可以下载下来借鉴一下。
代码片段和文件信息
package room.javabean;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class DAO {
private String url;
private String driver;
private String userName;
private String password;
private Connection conn;
private Statement stmt;
private ResultSet rest;
public DAO() {
url = “jdbc:sqlserver://SHUAI-PC:1433;DatabaseName=studyroom“;
driver = “com.microsoft.sqlserver.jdbc.SQLServerDriver“;
userName = “sa“;
password = “as“;
}
private void loadDriver() {
try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
private Connection getConnection() {
loadDriver();
try {
conn = DriverManager.getConnection(url userName password);
} catch (SQLException e) {
e.printStackTrace();
}
return conn;
}
//执行查询操作
public ResultSet queryExecute(String sql) {
try {
conn = getConnection();
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE ResultSet.CONCUR_READ_ONLY);
rest = stmt.executeQuery(sql);
} catch (SQLException e) {
e.printStackTrace();
}
return rest;
}
//增改返回影响的行数
public int updateExecute(String sql) {
int result = 0;
try {
conn = getConnection();
stmt = conn.createStatement();
result = stmt.executeUpdate(sql);
} catch (SQLException e) {
result = 0;
} finally {
Sqlclose();
}
return result;
}
//关闭
public void Sqlclose() {
try {
if (rest != null) rest.close();
if (stmt != null) stmt.close();
if (conn != null) conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 846 2012-03-30 14:57 classRoomManagement\.classpath
文件 1052 2012-03-30 14:57 classRoomManagement\.project
文件 503 2012-03-30 14:57 classRoomManagement\.settings\.jsdtscope
文件 89 2012-04-20 15:48 classRoomManagement\.settings\org.eclipse.core.resources.prefs
文件 395 2012-03-30 14:57 classRoomManagement\.settings\org.eclipse.jdt.core.prefs
文件 511 2012-03-30 14:57 classRoomManagement\.settings\org.eclipse.wst.common.component
文件 345 2012-03-30 14:57 classRoomManagement\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2012-03-30 14:57 classRoomManagement\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2012-03-30 14:57 classRoomManagement\.settings\org.eclipse.wst.jsdt.ui.superType.name
文件 2420 2012-05-06 10:22 classRoomManagement\build\classes\room\javabean\DAO.class
文件 1618 2012-05-06 10:22 classRoomManagement\build\classes\room\javabean\QueryBean.class
文件 3080 2012-05-06 10:22 classRoomManagement\build\classes\room\javabean\SqlExecute.class
文件 2493 2012-05-06 10:22 classRoomManagement\build\classes\room\javabean\StringUtil.class
文件 683 2012-05-06 10:22 classRoomManagement\build\classes\room\javabean\user.class
文件 1761 2012-04-21 00:15 classRoomManagement\src\room\javabean\DAO.java
文件 850 2012-04-15 21:14 classRoomManagement\src\room\javabean\QueryBean.java
文件 3512 2012-04-15 21:19 classRoomManagement\src\room\javabean\SqlExecute.java
文件 1649 2012-04-18 11:18 classRoomManagement\src\room\javabean\StringUtil.java
文件 419 2012-04-18 17:01 classRoomManagement\src\room\javabean\user.java
文件 4718 2012-05-05 21:56 classRoomManagement\WebContent\add.jsp
文件 3696 2012-05-14 17:30 classRoomManagement\WebContent\admin.jsp
文件 7711 2012-05-05 10:09 classRoomManagement\WebContent\admin_01.jsp
文件 1081 2012-05-06 18:44 classRoomManagement\WebContent\ajax.jsp
文件 4281 2012-05-05 10:11 classRoomManagement\WebContent\alter.jsp
文件 12200 2012-05-05 22:24 classRoomManagement\WebContent\buinessSchool.jsp
文件 610 2012-04-18 23:01 classRoomManagement\WebContent\check.jsp
文件 1407 2012-05-05 09:55 classRoomManagement\WebContent\CSS\admin.css
文件 2428 2012-04-21 12:10 classRoomManagement\WebContent\CSS\news.css
文件 3851 2012-04-21 15:14 classRoomManagement\WebContent\CSS\st
文件 1296 2012-05-05 16:16 classRoomManagement\WebContent\deal.jsp
............此处省略108个文件信息
- 上一篇:基于dsPIC的精跟踪控制系统设计
- 下一篇:基于ssh2的简单登陆注册系统
评论
共有 条评论