日期:2014-05-20 浏览次数:20775 次
public int GetIsNotNull(String dh_seq)throws Exception{
//构建数据操作对象
LogStatement prepStmt = null;
ResultSet rsResult = null;
int i=0;
//构建SQL操作
//所需要构建的sql语句为:select * from account_code where apply_id in ( )
//in( ) 里面的数值个数不确定,是根据传来的结果集个数确定。
//所以想知道怎么来拼装这个SQL 语句
try {
StringBuffer lSQL = new StringBuffer();
lSQL.append(" select * from account_code ");
//此处怎么拼装?
lSQL.append(" where apply_id in( )");
prepStmt = new LogStatement(conn, lSQL.toString());
//此处值如何装载进去?
prepStmt.setString(1, dh_seq);
prepStmt.printQueryString();
rsResult = prepStmt.executeQuery();
//判断是否有值
if(rsResult.next()){
i=-1;
}else{
i=1;
}
lSQL = null;
return i;
} catch (SQLException se) {
throw Exception("信息出现不可捕获的异常", se);
} catch (Exception ex) {
throw Exception(ex.getMessage(), ex);
} finally {
// 释放资源
FreeResource(prepStmt);
}
}