package aaa;
import java.sql.*;
public class DBOperate_wenti
{
Statement st;
Connection con;
ResultSet rs;
/*
public void connection() throws Exception
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:datastruct","root","");
st=con.createStatement();
}
*/
public void connection() throws Exception
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:datastruct","root","");
//st=con.createStatement();
st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
}
public ResultSet ListWenti() throws Exception//问题列表
{
connection();
rs=st.executeQuery("select * from wenti,user_information where wenti.userID=user_information.userID order by wentiID DESC");
return rs;
}
public ResultSet viewWenti(int id) throws Exception//查看问题
{
connection();
rs=st.executeQuery("select * from wenti,user_information where wenti.userID=user_information.userID and wentiID="+id);
return rs;
}
public ResultSet viewHuifu(int id) throws Exception//查看回复
{
connection();
rs=st.executeQuery("select * from huifu,user_information where huifu.userID=user_information.userID and huifuID="+id);
return rs;
}
public ResultSet ListHuifu(int id) throws Exception//回复列表
{
connection();
rs=st.executeQuery("select * from huifu,user_information where huifu.userID=user_information.userID and wentiID="+id+" order by huifuID ASC");//DESC
return rs;
}
public void AddNewWenti(String title,String content,int userID) throws Exception//提出新问题
{
String date=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date());
connection();
st.executeUpdate("insert into wenti (userID,wentiTitle,wentiContent,date) values("+userID+",'"+title+"','"+content+"','"+date+"')");
}
public void AddNewHuifu(int wentiID,String content,int userID) throws Exception//回复
{
String date=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date());
connection();
st.executeUpdate("insert into huifu (wentiID,userID,huifuContent,date) values("+wentiID+","+userID+",'"+content+"','"+date+"')");
}
public void UpdateHuifu(int huifuID,String content) throws Exception//修改回复
{
String date=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date());
connection();
st.executeUpdate("update huifu set huifuContent='"+content+"',editdate='"+date+"' where huifuID="+huifuID);
}
public void UpdateWenti(int wentiID,String content,String title) throws Exception//修改问题
{
String date=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date());
connection();
st.executeUpdate("update wenti set wentiTitle='"+title+"' , wentiContent='"+content+"',editdate='"+date+"' where wentiID="+wentiID);
}
public void DeleteWenti(int wentiID) throws Exception//删除问题
{
connection();
st.executeUpdate("delete from wenti where wentiID="+wentiID);
st.executeUpdate("delete from huifu where wentiID="+wentiID);
}
public void DeleteHuifu(int huifuID) throws Exception//删除回复
{
connection();
st.executeUpdate("delete from huifu where huifuID="+huifuID);
}
public void closeCon() throws Exception
{
con.close();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
jsp技术开发的精品课程网站(源代码)
共132个文件
jsp:45个
gif:14个
htm:14个
4星 · 超过85%的资源 需积分: 10 339 下载量 38 浏览量
2008-11-26
14:51:12
上传
评论 5
收藏 1.8MB RAR 举报
温馨提示
jsp技术开发的精品课程网站(源代码)...........................
资源推荐
资源详情
资源评论
收起资源包目录
jsp技术开发的精品课程网站(源代码) (132个子文件)
DBOperate_wenti.class 4KB
DBOperate_userinfo.class 3KB
DBOperate_xuexi.class 3KB
DBOperate_news.class 3KB
DBOperate_news.class 3KB
DBOperate_admin.class 1KB
Thumbs.db 135KB
fenghuolun.fla 446KB
wenti.frm 9KB
huifu.frm 9KB
news_t.frm 9KB
t_question.frm 8KB
student.frm 8KB
user_information.frm 8KB
t_admin.frm 8KB
a5.gif 5KB
a7.gif 5KB
a2.gif 5KB
a6.gif 5KB
a4_.gif 5KB
abc.gif 5KB
a8.gif 5KB
daohang.gif 4KB
a3.gif 2KB
a1.gif 2KB
a4.gif 2KB
pic1.gif 1KB
pic2.gif 1KB
titleb.gif 68B
sbcl.htm 32KB
jxdg.htm 6KB
jsdw.htm 5KB
kcjs.htm 4KB
login.htm 4KB
jxlx.htm 4KB
kjxz.htm 4KB
syzd.htm 4KB
ckwx.htm 4KB
ltxt.htm 4KB
zhuce.htm 3KB
login_.htm 3KB
_index.htm 2KB
login.htm 486B
_desktop.ini 9B
DBOperate_wenti.java 3KB
DBOperate_userinfo.java 3KB
DBOperate_xuexi.java 2KB
DBOperate_news.java 2KB
DBOperate_admin.java 612B
JDSJ070.jpg 57KB
090501-2161225.jpg 14KB
090501-2200110.jpg 12KB
index.jsp 7KB
index.jsp 6KB
wentilist.jsp 6KB
newslist.jsp 6KB
wentiview.jsp 5KB
userlist.jsp 5KB
newMima.jsp 4KB
editWenti.jsp 4KB
wentiview.jsp 4KB
huifuwenti.jsp 4KB
editHuifu.jsp 4KB
newUsername.jsp 4KB
test.jsp 3KB
newquestion.jsp 3KB
check.jsp 3KB
news.jsp 3KB
newwenti.jsp 3KB
newsview.jsp 3KB
index.jsp 3KB
new_news.jsp 2KB
stgl.jsp 2KB
update_mima.jsp 947B
addhuifu.jsp 917B
addwenti.jsp 896B
update_username.jsp 893B
addquestion.jsp 852B
registor.jsp 812B
updateWenti.jsp 812B
updateHuifu.jsp 761B
index.jsp 754B
deleteuser.jsp 733B
login.jsp 729B
deletehuifu.jsp 727B
deletewenti.jsp 723B
delete_news.jsp 716B
adminlogin.jsp 713B
addnews.jsp 706B
user_info.jsp 613B
logout.jsp 263B
logout.jsp 161B
err.jsp 71B
err.jsp 71B
err.jsp 71B
err.jsp 71B
editquestion.jsp 0B
ss.mdb 212KB
fenghuolun.swf.mno 137B
JDSJ070.jpg.mno 116B
共 132 条
- 1
- 2
muguangkui
- 粉丝: 14
- 资源: 319
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
前往页