请大家帮我看看怎么出不来咯?
我在Tool--- >Database pilot里面连接的是成功的
我的数据库名是yd,新建的表名是:Table1;
我是用jb做的
谢谢的
代码如下:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import java.sql.*;
/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */public class Frame1 extends JFrame {
  JPanel contentPane;
  XYLayout xYLayout1 = new XYLayout();
  JLabel jLabel1 = new JLabel();
  JTextField jTextField1 = new JTextField();
  JButton jButton1 = new JButton();
  JScrollPane jScrollPane1 = new JScrollPane();
  JTextArea jTextArea1 = new JTextArea();
  JButton jButton2 = new JButton();  //Construct the frame
  public Frame1() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }  //Component initialization
  private void jbInit() throws Exception  {
    contentPane = (JPanel) this.getContentPane();
    jLabel1.setText("输入要查询的名字");
    contentPane.setLayout(xYLayout1);
    this.setSize(new Dimension(400, 300));
    this.setTitle("Frame Title");
    jButton1.setText("查询");
    jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));
    jTextField1.setText("");
    jTextArea1.setText("");
    jButton2.setText("查询所有人");
    jButton2.addActionListener(new Frame1_jButton2_actionAdapter(this));
    contentPane.add(jLabel1,  new XYConstraints(24, 27, 107, 25));
    contentPane.add(jTextField1,  new XYConstraints(138, 29, 122, 24));
    contentPane.add(jButton1,  new XYConstraints(285, 29, 61, 24));
    contentPane.add(jScrollPane1,  new XYConstraints(17, 73, 366, 168));
    contentPane.add(jButton2, new XYConstraints(50, 254, 238, 26));
    jScrollPane1.getViewport().add(jTextArea1, null);
  }  //Overridden so we can exit when window is closed
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      System.exit(0);
    }
  }  void jButton1_actionPerformed(ActionEvent e) {
jTextArea1.setText("查询结果"+'\n');
    try{
      hu1();
    }catch(SQLException e1){}
  }  void jButton2_actionPerformed(ActionEvent e) {
    jTextArea1.setText("查询结果"+'\n');
     
  }
public void hu1()throws SQLException{
  String name;int physics,math,english;
  try{
     Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver" ) ;
}catch(ClassNotFoundException e){}
   Connection con=DriverManager.getConnection("jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=yd;user=sa;password=sa");
   Statement sql=con.createStatement();
   ResultSet rs=sql.executeQuery("SELECT * FROM  Table1");
   while(rs.next()){
     name = rs.getString("姓名");
     math = rs.getInt("数学");
     english = rs.getInt("英语");
     physics = rs.getInt("物理");
     if ( (name.trim()).equals(jTextField1.getText().trim()));
     {
       jTextArea1.append(name + "的成绩:" + "\n" + "数学:" + math + "英语" + english +
                         "物理" + physics + '\n');
     }
   }
if((jTextArea1.getText().trim()).equals("查询结果")){
     jTextArea1.setText("没有"); 
   }
}}class Frame1_jButton1_actionAdapter implements java.awt.event.ActionListener {
  Frame1 adaptee;  Frame1_jButton1_actionAdapter(Frame1 adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton1_actionPerformed(e);
  }
}class Frame1_jButton2_actionAdapter implements java.awt.event.ActionListener {
  Frame1 adaptee;  Frame1_jButton2_actionAdapter(Frame1 adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton2_actionPerformed(e);
  }
}