formId查询的条件字段,tableName是表名,fieldName要查询的字段
private static String getValue(String formId,String tableName,String fieldName)throws WfException{
Connection con = DbConnectionManager.getInstance().getConnection(
poolName);
Statement st = null;
String value = null;
try {
st = con.createStatement();
String iSql = "select "+fieldName+" from "+tableName+" where applyid='"+formId+"'";
ResultSet rs = st.executeQuery(iSql);
if (rs.next()) {
value = rs.getString(1);
}
} catch (Exception e) {
throw new WfException(ErrorInfo.EXT_PROC_MANAGER_ERROR,"获取值失败!",
ErrorInfo.getTrace(e, e.getStackTrace()));
} finally {
DbConnectionManager.getInstance().freeConnection(poolName, con);
}
return value;
}