public Middle getAllXh(String xhxh) throws SQLException {
Middle cjb = null;
sql = con.createStatement();
rs = sql.executeQuery("select * from chengjibiao where xh='" + xhxh
+ "'");
while (rs.next()) {
cjb = new Middle();
cjb.setXh(rs.getString(1));
cjb.setXm(rs.getString(2));
cjb.setSj(rs.getString(3));
cjb.setSx(rs.getInt(4));
cjb.setWl(rs.getInt(5));
cjb.setYy(rs.getInt(6));
}
return cjb;
}//服务器段
if (e.getSource() == bt5) {
area.setText(null);
try {
String xh = pan.txt1.getText().trim();
Server c = new Server();
Middle cjb = new Middle();
c.connect();
cjb = c.getAllXh(xh);
if (cjb != null) {
area.append(cjb.getXh());
area.append("\n");
area.append(cjb.getXm());
area.append("\n");
area.append(cjb.getSj());
area.append("\n");
area.append(String.valueOf(cjb.getSx()));
area.append("\n");
area.append(String.valueOf(cjb.getWl()));
area.append("\n");
area.append(String.valueOf(cjb.getYy()));
area.append("\n");
pan.txt1.setText(cjb.getXh());
pan.txt2.setText(cjb.getXm());
pan.txt3.setText(cjb.getSj());
pan.txt4.setText(String.valueOf(cjb.getSx()));
pan.txt5.setText(String.valueOf(cjb.getWl()));
pan.txt6.setText(String.valueOf(cjb.getYy()));
} else {
JOptionPane.showMessageDialog(this, "查无此消息", "信息",
JOptionPane.INFORMATION_MESSAGE);
pan.txt1.setText(null);
pan.txt1.requestFocus();
}
} catch (Exception e1) {
System.out.println("查询出错:" + e1);
}//按钮触发事件;
Middle为 javabean
编号 和姓名 不能显示 为什么? 小弟急求答案 希望高手给与帮助谢谢。