首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

提问~该怎么处理

2012-01-22 
提问~publicvoidShujukuBookShow(){ConnectionconStatementsqlResultSetrstry{Class.forName( sun.jdb

提问~
public   void   ShujukuBookShow(){
Connection   con;
Statement   sql;  
ResultSet   rs;
try{
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
}
catch(ClassNotFoundException   e){
System.out.println( " "+e);
}
try{
con=DriverManager.getConnection( "jdbc:odbc:图书管理系统 ", " ", " ");sql=con.createStatement();
rs=sql.executeQuery( "SELECT   *   FROM   书籍管理   WHERE   书名= ' "+text1.getText().trim()+ " ' ");
boolean   isexist=false;
try{
isexist=rs.next();
}
catch(SQLException   ex){}
if(!isexist){
JOptionPane.showMessageDialog(null, "该书不存在! ");
rs.first();
}
                    else{
try{
rs.first();
text2.setText(rs.getString( "出版社 "));
text3.setText(rs.getString( "作者 "));
text4.setText(rs.getString( "出版社地址 "));
text5.setText(rs.getString( "出版日期 "));
text6.setText(rs.getString( "价格 "));
text7.setText(rs.getString( "评论 "));
}
catch(SQLException   e1){e1.printStackTrace();}
con.close();
}
}
catch(SQLException   e1){}

}
为什么其中的
text2.setText(rs.getString( "出版社 "));
text3.setText(rs.getString( "作者 "));
text4.setText(rs.getString( "出版社地址 "));
text5.setText(rs.getString( "出版日期 "));
text6.setText(rs.getString( "价格 "));
text7.setText(rs.getString( "评论 "));
这段代码总是实现不了呀?


[解决办法]
为什么不把出错信息贴出来呢?

热点排行