java swing 界面模糊查询?为什么表格不显示数据 10
publicVector<Vector>searchMemInfo_theme(Stringtheme){//TODOAuto-generatedmethodstubLo...
public Vector<Vector> searchMemInfo_theme(String theme) {
// TODO Auto-generated method stub
Log.log(this, "searchMemInfo_theme");
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
Vector v = null;
Vector<Vector> meminfo = new Vector<Vector>();
try {
conn = Dbcp.getConnection();
stmt = conn.prepareStatement(Constants.QUERY_MEMORANDUM_THEME);
stmt.setString(1, "'%"+theme+"%'");
Log.log(this, "'%"+theme+"%'");
rs = stmt.executeQuery();
while(rs.next()){
Log.log(this, "MemDao:");
v = new Vector();
v.add(rs.getInt("M_NUM"));
v.add(rs.getString("M_THEME"));
v.add(rs.getString("M_CONTENT"));
v.add(rs.getString("M_WEEK"));
v.add(rs.getTimestamp("M_TIME"));
meminfo.add(v);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
Dbcp.close(rs,stmt, conn);
Log.log( this, "savememinfo:"+Constants.QUERY_MEMORANDUM_THEME);
}
return meminfo;
} 展开
// TODO Auto-generated method stub
Log.log(this, "searchMemInfo_theme");
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
Vector v = null;
Vector<Vector> meminfo = new Vector<Vector>();
try {
conn = Dbcp.getConnection();
stmt = conn.prepareStatement(Constants.QUERY_MEMORANDUM_THEME);
stmt.setString(1, "'%"+theme+"%'");
Log.log(this, "'%"+theme+"%'");
rs = stmt.executeQuery();
while(rs.next()){
Log.log(this, "MemDao:");
v = new Vector();
v.add(rs.getInt("M_NUM"));
v.add(rs.getString("M_THEME"));
v.add(rs.getString("M_CONTENT"));
v.add(rs.getString("M_WEEK"));
v.add(rs.getTimestamp("M_TIME"));
meminfo.add(v);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
Dbcp.close(rs,stmt, conn);
Log.log( this, "savememinfo:"+Constants.QUERY_MEMORANDUM_THEME);
}
return meminfo;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询