public void dbrSQL(String rID, String rSql) throws SysExcpt {
ResultSet lRSet; try {
Statement lStat = gConn.createStatement();
lRSet = lStat.executeQuery(rSql);
if (lRSet.next()) {
dbrSuccess();
}
else {
dbrEndOfData();
} if (rID == null) {
gRSet = lRSet;
gStat = lStat;
}
else {
gRSetHash.put(rID, lRSet);
gStatHash.put(rID, lStat);
}
}
catch (SQLException e) {
dbrAnalyzeERO(e);
if (dbrIsFatal()) {
throw new SysExcpt("DBase", "dbrSQL()", e.toString());
}
}
}
ResultSet lRSet; try {
Statement lStat = gConn.createStatement();
lRSet = lStat.executeQuery(rSql);
if (lRSet.next()) {
dbrSuccess();
}
else {
dbrEndOfData();
} if (rID == null) {
gRSet = lRSet;
gStat = lStat;
}
else {
gRSetHash.put(rID, lRSet);
gStatHash.put(rID, lStat);
}
}
catch (SQLException e) {
dbrAnalyzeERO(e);
if (dbrIsFatal()) {
throw new SysExcpt("DBase", "dbrSQL()", e.toString());
}
}
}
ResultSetMetaData metadata = null;metadata = rs.getMetaData();
int columnCount = metadata.getColumnCount();
dbColumnNames = new String[columnCount];for(int i = 0; i < columnCount; i++) {
dbColumnNames[i] = metadata.getColumnName(i + 1);
}rs.last();
int rowCount = rs.getRow()
HashMap oMap = new HashMap[rowCount];
rs.first();
for (int i=0;i<rowCount;i++) {
for (int j = 1; j <= columnCount; j++) {
oMap[i].put(dbColumnNames[j], rs.getObject(j));
}
rs.next()
}
什么时候也开始用java了:)楼上的就可以了!