当前位置: 技术问答>java相关
为什么用rs.getColumnCount()总是报错!
来源: 互联网 发布时间:2015-07-09
本文导语: CallableStatement pStmt = null; ResultSet rs = null; int count=0; try{ pStmt = conn.prepareCall("{ ? = call Xxmd002_420_SLCT2.Xxmd002_420_SLCT2(?,?)}"); pStmt.setInt(2, Integer.parseInt(getsno())); pStmt.setInt(3, Integer.parseInt(getno())); pSt...
CallableStatement pStmt = null;
ResultSet rs = null;
int count=0;
try{
pStmt = conn.prepareCall("{ ? = call Xxmd002_420_SLCT2.Xxmd002_420_SLCT2(?,?)}");
pStmt.setInt(2, Integer.parseInt(getsno()));
pStmt.setInt(3, Integer.parseInt(getno()));
pStmt.registerOutParameter (1, OracleTypes.CURSOR);
pStmt.execute();
rs = (ResultSet)pStmt.getObject(1);
count=rs.getColumnCount();
if(rs.next()==false){
seterrorMsg("no data found in ??? according to ????");
}
} finally{
if(rs != null){
rs.close();
rs = null;
}
if(pStmt != null){
pStmt.close();
pStmt = null;
}
}
ResultSet rs = null;
int count=0;
try{
pStmt = conn.prepareCall("{ ? = call Xxmd002_420_SLCT2.Xxmd002_420_SLCT2(?,?)}");
pStmt.setInt(2, Integer.parseInt(getsno()));
pStmt.setInt(3, Integer.parseInt(getno()));
pStmt.registerOutParameter (1, OracleTypes.CURSOR);
pStmt.execute();
rs = (ResultSet)pStmt.getObject(1);
count=rs.getColumnCount();
if(rs.next()==false){
seterrorMsg("no data found in ??? according to ????");
}
} finally{
if(rs != null){
rs.close();
rs = null;
}
if(pStmt != null){
pStmt.close();
pStmt = null;
}
}
|
ResultSetMetaData rsmd = rs.getMetaData();
int column = rsmd.getColumnCount();
int column = rsmd.getColumnCount();