public static synchronized PreparedStatement getPs_selectBoat(Connection conn) throws Exception {
if (ps_seGPS == null) {
String selectSql = "select count(0) from BOATINFO b where b.id = ? ";
ps_seGPS = conn.prepareStatement(selectSql);
}
return ps_seGPS;
} public static String selectBoatInfo(String id, Connection conn) throws Exception {
String resul1t = "0";
PreparedStatement ps = getPs_selectBoat(conn);
ps.setString(1, id);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
resul1t = rs.getObject(1).toString();
}
return resul1t;
}查询时当表中没有数据还是返回1.
if (ps_seGPS == null) {
String selectSql = "select count(0) from BOATINFO b where b.id = ? ";
ps_seGPS = conn.prepareStatement(selectSql);
}
return ps_seGPS;
} public static String selectBoatInfo(String id, Connection conn) throws Exception {
String resul1t = "0";
PreparedStatement ps = getPs_selectBoat(conn);
ps.setString(1, id);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
resul1t = rs.getObject(1).toString();
}
return resul1t;
}查询时当表中没有数据还是返回1.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货