你在初始化中加入试试:class test2()
{
ResultSet resultSet = null;
public test2(ResultSet result){
resultSet = resylt;
}
}test1中改称:
test2 test =new test2(resultSet);
test.thinExpertToXML();
{
ResultSet resultSet = null;
public test2(ResultSet result){
resultSet = resylt;
}
}test1中改称:
test2 test =new test2(resultSet);
test.thinExpertToXML();
你应该是
在test1内main()方法内:
test2 t = new test2();
t.thrinExperToXML(resultSet);-------应该是这样调用的
}
public String thinExpertToXML(ResultSet resultSet)
{
try{
resultSet.next();
System.out.println(resultSet.getString("id"));
}catch(SQLException e){
e.printStackTrace();
}
return null;
}}
这样可以调试成功,但是,已经是下一条记录了,我平时用的是vector,或者是写一个对应于字段的类,然后用对象数组