Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.sql.SQLException: No data found error

807598Oct 26 2006 — edited Oct 26 2006
Hi

When I try and retrieve data from my database and send the result to the 'text' variable then output it the query works, however when I try and send the result to 'bcTF1.setText(rs.getString(i));' (textField) it says no data found. any ideas? thanx in advance
  
public void executeQuery() throws SQLException {

      boolean foundResults =
         statement.execute("SELECT Blink1, Blink2, Blink3, Blink4, Reason, Effect  " +
              "FROM BlinkCode WHERE BlinkCodeID = 1");
      if(foundResults){
         ResultSet set = statement.getResultSet();
         if(set!=null) displayResults1(set);
      }else {
         connection.close();
      }
   }

 void displayResults1(ResultSet rs) throws SQLException {
      ResultSetMetaData metaData = rs.getMetaData();
      int columns=metaData.getColumnCount();
      String text="";
        new Blinkcodes().setVisible(true);
      while(rs.next()){
         for(int i=1;i<=columns;++i) {
            text+="<"+metaData.getColumnName(i)+">";
            text+=rs.getString(i);
            bcTF1.setText(rs.getString(i));
           //  text+="</"+metaData.getColumnName(i)+">";
             text+="/n";
         }
         text+="/n";
      }

      System.out.println(text);

   }
Message was edited by:
crashEvans
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 23 2006
Added on Oct 26 2006
9 comments
860 views