首页>代码>纯JSP+Tomcat的java web网络应急响应平台>/InternetSys/src/BeanProcess/FeedbackPro.java
package BeanProcess;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import DatabaseConnect.ConnectDB;

public class FeedbackPro {
	
	private Connection ct = null;
	private ResultSet rs = null;
	private PreparedStatement sta = null;
	
	
	public boolean addFeedback(int taskid,String content) {
		boolean b = false;
		String sql = "insert into feedback (taskid,content) values('"+taskid+"','"+content+"')";
		try {
			ConnectDB cdb = new ConnectDB();
			ct = cdb.getConn();
			sta = ct.prepareStatement(sql);
			int a = sta.executeUpdate();
			if (a == 1) {
				b = true;
			}
		} catch (Exception ex) {
			// TODO: handle exception
			ex.printStackTrace();
		}finally{
			this.closeM();
		}
		return b;
	}
	
	public boolean updateFeedback(int taskid,int status) {
		boolean b = false;
		String sql = "update taskone set status='"+status+"' where taskid='"+taskid+"'";
		try {
			ConnectDB cdb = new ConnectDB();
			ct = cdb.getConn();
			sta = ct.prepareStatement(sql);
			int a = sta.executeUpdate();
			if (a == 1) {
				b = true;
			}
		} catch (Exception ex) {
			// TODO: handle exception
			ex.printStackTrace();
		}finally{
			this.closeM();
		}
		return b;
	}
	
	public void closeM() {
		if (rs!=null) {
			try {
				rs.close();
				rs = null;
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		if (ct!=null) {
			try {
				ct.close();
				ct = null;
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		if (sta!=null) {
			try {
				sta.close();
				sta = null;
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
最近下载更多
asddwh  LV12 2023年12月29日
3305787467  LV12 2022年5月24日
839927965  LV2 2022年4月18日
famloliy  LV6 2021年8月23日
Chubby  LV3 2021年7月5日
xuzh666  LV2 2021年4月19日
ericxu1116  LV24 2021年4月13日
fanuel  LV2 2021年3月8日
xhmpmail  LV17 2021年2月23日
1qw23456  LV10 2020年12月29日
最近浏览更多
暂无贡献等级
asddwh  LV12 2023年12月29日
颜菜菜  LV2 2023年12月23日
akittyboy  LV9 2023年12月6日
ncyhhh  LV1 2023年11月26日
泓鼎168  LV19 2023年9月22日
dhbply 2023年8月16日
暂无贡献等级
TTtttH 2023年6月24日
暂无贡献等级
qazws123  LV1 2023年6月7日
fewfsdaf  LV4 2023年4月18日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友