提问~
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( "评论 "));
这段代码总是实现不了呀?
------解决方案--------------------为什么不把出错信息贴出来呢?