从数据库出的值rs.getString(i+1)赋值不进去asd[i],怎么改?
private boolean jButtonactionPerformed(ActionEvent e) {try
{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:ds;DatabaseName=uubird";
Connection con=DriverManager.getConnection(url,"sa","asd");
java.sql.Statement pst=con.createStatement();
String yh=jTextField.getText();
String pw=new String(jPasswordField.getPassword());
String sql="select * from addressbook where yonghu='"+yh+"'and password='"+pw+"'";
System.out.println(sql);
ResultSet rs =pst.executeQuery(sql);
boolean dd=rs.next();
try{
if(dd){
for(int i=1;i<3;i++)
{ System.out.println(rs.getString(i+1));
/*在以下程序总是运行错误!值rs.getString(i+1)赋值不进去asd[i];
说报错,不知道这个是怎么回事?!!高手帮帮忙啦
*/
zzdd.this.asd[i]=rs.getString(i+1);
System.out.println( asd[i]+"==================");
}
System.out.println(rs.getDate(4));
for(int j=4;j<7;j++)
{ System.out.println(rs.getString(j+1).toString());
}
}
}catch(Exception e1e)
{
System.out.println("===============zhe li cuo la =======================");
}
if(dd){
pst.close();
con.close();
zzdd.this.dispose();
return true;}
}catch(Exception ee)
{
JOptionPane.showMessageDialog(this, "登入失败!","登入",JOptionPane.INFORMATION_MESSAGE);
}
return false;
}