求数据库有关的问题!!!!
我做了两个界面为:searchclass和studentInfoClass,我想在studentInfoClass中显示,在searchclass查找到的内容.可是在studentInfoClass 中不能显示,求高手指教.代码如下:
studentInfoClass sic=new studentInfoClass();
if(jrb1.isSelected())
{
searchNumber1=jtf1.getText();
System.out.println( "num1 ");
sql= "select * from stuTable where Num= ' " + searchNumber1 + " ' ";
rs=DB.getResult(sql);
while(rs.next())
{
sic.jTextField1.setText(rs.getString(1));
sic.jTextField2.setText(rs.getString(2));
sic.jTextField3.setText(rs.getString(3));
sic.jTextField4.setText(rs.getString(7));
sic.jTextField5.setText(rs.getString(4));
sic.jTextField6.setText(rs.getString(5));
sic.jTextField7.setText(rs.getString(6));
}
数据库连接没有问题,只是查到的值无法传到studentInfoClass
------解决方案--------------------呵呵 代碼太少看不出来问题
------解决方案--------------------那你的Result出了变量作用区了~~估计实现的逻辑有问题