求帮忙找出空指针变量值
package com.xiangrong.window;import java.sql.ResultSet;
import java.util.Vector;
import javax.swing.table.AbstractTableModel;
import com.mysql.jdbc.ResultSetMetaData;
import com.xiangrong.jdbc.SqlHelpClient;
public class ClieModel extends AbstractTableModel{
Vector rowVector, cloumVector1;
ResultSet resultSets ;
SqlHelpClient sqlHelperCliemnt = null;
ResultSetMetaData rst = null;
public boolean updateClie(String sql,String name[]){
SqlHelpClient help = new SqlHelpClient();
return help.upclent(sql, name);
}
public void qureyClie(String sql,String name[]){
rowVector = new Vector();
rowVector.add("编号");
rowVector.add("姓名");
rowVector.add("性别");
rowVector.add("年龄");
rowVector.add("身份证");
rowVector.add("民族");
rowVector.add("电话");
rowVector.add("房间号");
rowVector.add("客户状态");
rowVector.add("入住时间");
rowVector.add("退房时间");
rowVector.add("天数");
rowVector.add("结算");
cloumVector1 = new Vector();
try {
sqlHelperCliemnt = new SqlHelpClient();
resultSets = sqlHelperCliemnt.queryClient(sql, name);
rst = (ResultSetMetaData) resultSets.getMetaData();
while (resultSets.next()) {
Vector temp = new Vector();
temp.add(resultSets.getString(1));
temp.add(resultSets.getString(2));
temp.add(resultSets.getString(3));
temp.add(resultSets.getInt(4));
temp.add(resultSets.getString(5));
temp.add(resultSets.getString(6));
temp.add(resultSets.getString(7));
temp.add(resultSets.getString(8));
temp.add(resultSets.getString(9));
temp.add(resultSets.getString(10));
temp.add(resultSets.getString(11));
temp.add(resultSets.getString(12));
temp.add(resultSets.getString(13));
/* for(int i=0;i<rst.getColumnCount();i++)
{
temp.add(resultSets.getString(i+1));
}*/
cloumVector1.add(temp);
}
System.out.println(rowVector.size());
System.out.println(cloumVector1.size());
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}finally{
sqlHelperCliemnt.close();
}
}
/* @Override
public String getColumnName(int column) {
// TODO Auto-generated method stub
return (String) this.cloumVector1.get(column);
}*/
@Override
public int getColumnCount() {
// TODO Auto-generated method stub
return this.rowVector.size();
/* return 0;*/
}
@Override
public int getRowCount() {
// TODO Auto-generated method stub
return this.cloumVector1.size();
/*return 0;*/
}
@Override
public Object getValueAt(int arg0, int arg1) {
// TODO Auto-generated method stub
return( (Vector)this.rowVector.get(arg0)).get(arg1);
}
}
异常 --------------------编程问答-------------------- 你直接去看抛出的异常不就能找到了吗? --------------------编程问答-------------------- 还是告诉你吧 你这里面没构造方法,你定义的那几个属性都不能够初始化,getcolumnCount和getrowcount是在改革建立的时候就要去调用的 不是你之后才会去调用 ,所以把构造方法写一下吧,或者直接初始化它们 --------------------编程问答-------------------- 好的,谢谢。已经解决了
补充:Java , Java SE