不知道为啥,解释执行时老是出现问题,大家帮我看一下
import java.sql.*;
import java.awt.event.*;
import javax.swing.*;
class sqlTest
{
public static void main(String[] args)
{
JFrame jf=new JFrame( "The system of Student informaton ");
jf.setSize(600,400);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel jp=new JPanel();
JLabel jl=new JLabel( "Please input student 's IDnumber ");
final JTextField jtf=new JTextField(15);
final JTextArea jta=new JTextArea();
JButton jb=new JButton( "Select ");
jf.getContentPane().add(jp, "North ");
jf.getContentPane().add(jta, "Center ");
jf.getContentPane().add(jb, "South ");
jp.add(jl);
jp.add(jtf);
jf.setVisible(true);
jb.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;
try
{
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
}
catch(
ClassNotFoundException ce)
{
ce.printStackTrace();
//System.out.println( "my a Class
NotFoundException wrong ");
}
try
{
conn=DriverManager.getConnection( "jdbc:odbc:test: ");
stmt=conn.createStatement();
String strNumber=jtf.getText();
String strSql= "select * from grade where StuNumber=strNumber ";
rs=stmt.executeQuery(strSql);
String strline=System.getProperty( "line.separator ");
while(rs.next())
{
jta.append(rs.getString( "学号 "));
jta.append(strline);
jta.append(rs.getString( "姓名 "));
jta.append(strline);
jta.append(rs.getString( "语文 "));
jta.append(strline);
jta.append(rs.getString( "数学 "));
jta.append(strline);
jta.append(rs.getString( "英语 "));
}
}
catch(
SQLException se)
{
se.printStackTrace();
//System.out.println( "my a executeQueryException wrong ");
}
finally
{
try
{
conn.close();
stmt.clo