如何将一个ResultSet结果集转化为一个Vector?我这样写对不对?
我的代码:
private Vector vt=null;
public void TranslateRs(ResultSet MyRs)
{
Hashtable ht=new Hashtable();
for (int i = 1; i <= MyRs.getMetaData().getColumnCount(); i++)
{
ht.put(MyRs.getMetaData().getColumnName(i),check(MyRs.getString(i)));
}
vt.addElement(ht);
}
private static String check(String checkStr) {
if (checkStr == null) {
return "";
}
else {
return checkStr;
}
}
老是报如下错误:
unreported exception java.sql.SQLException;must be caught or declared to be thrown……
大概就是说我的数据集有问题。请大虾看看,谢了先。