📄 faqdao.java~12~
字号:
package com.accp.xdj.faqload.server.dao;
import com.accp.xdj.faqload.server.entity.FAQ;
import java.sql.*;
public class FAQDAO {
public FAQ getDetail(FAQ f){
FAQ faq = new FAQ();
Connection conn = ConnectionManage.getConnection();
String sql = "select detail from faq where faq=?";
PreparedStatement ps=null;
ResultSet rs = null;
try {
ps = conn.prepareStatement(sql);
ps.setString(1, f.getFaq());
rs = ps.executeQuery();
if(rs.next())
faq.setDetail(rs.getString(1));
}
catch (SQLException ex) {
}
finally{
ConnectionManage.close(rs);
ConnectionManage.close(ps);
ConnectionManage.close(conn);
}
return faq;
}
public FAQ getFAQ(){
FAQ faq = new FAQ();
Connection conn = ConnectionManage.getConnection();
String sql = "select id, faq from faq order by id asc";
Statement ps=null;
ResultSet rs = null;
try {
ps = conn.createStatement();
rs = ps.executeQuery(sql);
while(rs.next()){
faq.setId(rs.getInt(1));
faq.setFaq(rs.getString(2));
}
}
catch (SQLException ex) {
}
finally{
ConnectionManage.close(rs);
ConnectionManage.close(ps);
ConnectionManage.close(conn);
}
return faq;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -