2016-10-23 3 views
0

私は献血関連のプロジェクトを行っています。 私は、最後の寄付の入場番号と翌年の年が保存されているuser_donという名前のテーブルと、入館番号の電話番号などが保存されているname_don_detという2つのテーブルがあることが問題です。netbeansのVectorを使用してテーブルを挿入する

user_view(String d1, String d2, String d3) throws ClassNotFoundException, SQLException { 
    initComponents(); 
    int a = Integer.parseInt(d1); 
    int b = Integer.parseInt(d2); 
    int c = Integer.parseInt(d3); 
    int year=a; 
    int month=b; 
    int date=c; 
    String query; 
    String query1; 
    if(b<=6) 
    { 
     year=a-1; 
     month=b+6; 
     query="Select * from user_don_det where Year<="+ year +" and Month<="+ month +""; 
     query1="SELECT * FROM `user_det` WHERE `Admission`=(Select Admission From user_don_det where Year<="+ year +" and Month<="+ month +")"; 
    } 
    else 
    { 
     month=b-6; 
     query="Select * from user_don_det where Month<="+ month +" or Year<="+ year +""; 
     query1="SELECT * FROM `user_det` WHERE `Admission`=(Select Admission From user_don_det where Month<="+ month +")"; 
    } 

    blooddonation.dbconnectivity db=new blooddonation.dbconnectivity(); 
    ResultSet rs=db.q_execute(query);  
    ResultSet rs1=db.q_execute(query1); 

    Vector data=new Vector(); 
    while(rs.next()) 
    { 
     Vector row=new Vector(); 
     row.addElement(rs.getInt(1)); 
     row.addElement(rs.getInt(2)); 
     row.addElement(rs.getInt(3)); 
     row.addElement(rs.getInt(4)); 

     data.addElement(row); 
    } 
    while(rs1.next()) 
    {Vector row=new Vector(); 
     row.addElement(rs1.getString(1)); 
     row.addElement(rs1.getString(2)); 
     row.addElement(rs1.getString(6)); 
     row.addElement(rs1.getInt(8)); 
     data.addElement(row); 
    } 


    Vector head=new Vector(); 
    head.addElement("Admission No"); 
    head.addElement("Date"); 
    head.addElement("Month"); 
    head.addElement("Year"); 
    head.addElement("Name"); 
    head.addElement("Email"); 
    head.addElement("Sex"); 
    head.addElement("Phone"); 

    DefaultTableModel model=new DefaultTableModel(data,head); 
    tab.setModel(model); 

}ここで

は、現在のエラー状態である: 私は一緒にベクトルまたは何か他のものを使用して、2つのテーブルからデータを取得すると時間でそれを示しては。これは私がきたものである

55`:
SEVERE: null 
java.sql.SQLException: Operation not allowed after ResultSet closed 
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074) 
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988) 
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974) 
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919) 
    at com.mysql.jdbc.ResultSetImpl.checkClosed(ResultSetImpl.java:804) 
    at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:6986) 
    at blooddonation.user_view.<init>(user_view.java:55) 
    at blooddonation.user_fscreen$5.actionPerformed(user_fscreen.java:263) 
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) 
+0

'user_view.javaどの行をさ=の代わりに使用されることになっていましたか? [MCVE]を投稿する:あなたの問題を示すために最小限の投稿をしてください。 (最小限のケースを書くことは、良いデバッグ手法です。そうすることで、問題を解決する可能性が高くなります)。 – c0der

答えて

0

エラーが解決されました。.. INは

関連する問題