package bean.Databaseconn;
import java.sql.*;
public class DataBaseConn
{
private static final int i = 0;
String driver="com.microsoft.jdbc.sqlserver.SQLServerDriver";
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=library";
static ResultSet rs=null;
static Connection conn=null;
static Statement stmt=null;
static PreparedStatement pstmt = null ;
public DataBaseConn()
{
try
{ //注册数据库驱动
Class.forName(driver).newInstance();
//建立数据库连接
conn=DriverManager.getConnection(url,"sa","sa");
}
catch(Exception e)
{
e.printStackTrace();
}
}
public Connection getConn()
{
return conn;
}
public boolean checkadminlogin(String sql)
{
boolean flg=false;
try {
stmt=conn.createStatement();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
rs=stmt.executeQuery(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
if(rs.next())
{
flg=true;
}
else
{
flg=false;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return flg;
}
//图书类型添加
public boolean booktypeadd(String sql)
{
boolean mm=false;
if(mm=true)
{
try {
stmt=conn.createStatement();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
stmt.executeUpdate(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else
{
return false;
}
return mm;
}
//图书类型查询
public ResultSet getRs_booktype() throws SQLException
{
String sql="select * from booktype";
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery(sql);
return rs;
}
public boolean update(String sql)
{
try {
stmt=conn.createStatement();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
int i = stmt.executeUpdate(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(i>0)
{
return true;
}
else
{
return false;
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
JSP图书管理系统MVC模式的
共120个文件
gif:61个
jsp:8个
java:7个
4星 · 超过85%的资源 需积分: 9 41 下载量 72 浏览量
2009-01-05
12:45:43
上传
评论 2
收藏 893KB RAR 举报
温馨提示
用JSP做的图书管理系统,是基于三层架构的基础上做的哦~
资源详情
资源评论
资源推荐
收起资源包目录
JSP图书管理系统MVC模式的 (120个子文件)
AdminTree.html.bak 3KB
adminbook.jsp.bak 846B
DataBaseConn.class 3KB
BooktypeupdateAction.class 2KB
AdminloginAction.class 2KB
BooktypeaddAction.class 2KB
BooktypeupdateForm.class 1KB
BooktypeaddForm.class 1KB
AdminloginForm.class 1KB
.classpath 739B
style.css 2KB
toc.css 620B
Thumbs.db 90KB
Thumbs.db 11KB
Thumbs.db 8KB
newtitle.gif 202KB
2284008.gif 47KB
ex_reg.gif 3KB
wc_1.gif 2KB
cart04.gif 2KB
cart03.gif 2KB
c1.gif 2KB
c3.gif 2KB
c2.gif 2KB
about.gif 2KB
edit.gif 1KB
about_a.gif 1KB
favourable_a.gif 1015B
bank_a.gif 906B
titlemu_2.gif 888B
login_bt_wm.gif 815B
na-122.gif 777B
Favorites2.gif 695B
na-121.gif 694B
go.gif 679B
login_bt_zc.gif 568B
goumai.gif 561B
na-29.gif 543B
log_06.gif 542B
log_05.gif 537B
splitcoin.gif 530B
upcoin.gif 523B
downcoin.gif 510B
righticon.gif 507B
lefticon.gif 507B
log_07.gif 477B
login_bt_login.gif 470B
Favorites.gif 428B
search1.gif 406B
search2.gif 402B
xx.gif 399B
delete.gif 397B
arrowDn.gif 369B
arrowUp.gif 366B
online_admin.gif 315B
online_member.gif 315B
online_moderator.gif 315B
online_supermod.gif 315B
top.gif 224B
top.gif 224B
2_clos.gif 114B
2_clos.gif 114B
2_open.gif 111B
2_open.gif 111B
3_clos.gif 108B
3_clos.gif 108B
3_open.gif 104B
3_open.gif 104B
2_none.gif 84B
2_none.gif 84B
3_none.gif 77B
3_none.gif 77B
4_none.gif 69B
4_none.gif 69B
4_clos.gif 58B
4_clos.gif 58B
AdminTree.html 3KB
TestTV20.html 475B
msbase.jar 280KB
mssqlserver.jar 65KB
msutil.jar 58KB
smartupload.jar 16KB
DataBaseConn.java 2KB
AdminloginForm.java 2KB
BooktypeupdateAction.java 2KB
BooktypeupdateForm.java 2KB
AdminloginAction.java 2KB
BooktypeaddAction.java 2KB
BooktypeaddForm.java 1KB
SalesCount.jpg 8KB
bank.jpg 2KB
TV20.js 15KB
TV20.js 15KB
regcheckdata.js 4KB
AdminTree.js 2KB
adminbook.jsp 3KB
booktypelist.jsp 2KB
adminlogin.jsp 1KB
booktypeupdate.jsp 1KB
booktypeadd.jsp 998B
共 120 条
- 1
- 2
m0701lvzhen
- 粉丝: 15
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论3