- 論壇徽章:
- 0
|
一個DB2的sql錯誤!
Vector tempList =
adbaccess1.selectSjz_NfYf(aztxxid, akfxxid, anf, ayf);
InfoOut.ErrOut("**********" + tempList.size() + "*****************" ;
aConnection = tempbean.getConn();
KcsjzDbaccess adbaccess = new KcsjzDbaccess(aConnection);
aConnection.setAutoCommit(false);
for (int i = 0; i < tempList.size(); i++) {
String tempjjfs =
aHelper.getJJFS(
aform.WLXXID,
akfxxid,
aztxxid,
aConnection);
}
--------------------------------------------------
public String getJJFS(String WLXXID, String KFXXID, String ZTXXID)
{
}
try {
do {
String sql =
"select jjfs from t_jjfs where wlxxid='"
+ tempwlxxid
+ "' and (kfxxid is null or kfxxid='"
+ KFXXID
+ "') and ztxxid='"
+ ZTXXID
+ "'";
if (aConnection == null) {
conn = getConn();
}else{
conn = aConnection;
}
//System.out.println("*******************aConnection**********************"+aConnection);
pstmt = getPstmt(conn, sql);
rs = this.pstmtQuery(pstmt);
if (rs.next()) {
returnvalue = rs.getString("jjfs" ;
}
if (returnvalue == null || returnvalue.equals("" ) {
tempwlxxid = getSJWL(tempwlxxid);
} else {
break;
}
} while (!tempwlxxid.equals("" );
-----------------------------------------
private String getSJWL(String aWlxxid) throws Exception {
String returnvalue = "";
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
String sql =
"select sjwl from t_wlxx where wlxxid='" + aWlxxid + "'";
if (aConnection == null) {
conn = getConn();
}else{
conn = aConnection;
}
//System.out.println("*******************aConnection**********************"+aConnection);
pstmt = getPstmt(conn, sql);
rs = this.pstmtQuery(pstmt);
if (rs.next()) {
returnvalue = rs.getString("sjwl" ;
}
} catch (Exception e) {
throw e;
} finally {
if (aConnection == null) {
freeConn(rs, pstmt, conn);
} else {
freeConn(rs, pstmt);
}
return returnvalue;
}
} |
|