Hey Guys,

I am working on a search that takes in a value via textfield. Once taken in it should display another Jframe with the info but the searchbox crashes the second I run it.

Its some stupid mistake I have made or i have gone about it the wrong way but at this stage my brain is fried from lookin at this code and i am not making any head way.

The search box Code:

import com.sun.rowset.JdbcRowSetImpl;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Joe Lyons
 */
public class BB_Value_SearchBox extends javax.swing.JFrame {

    /**
     * Creates new form BB_Value_SearchBox
     */
    public BB_Value_SearchBox() {
        initComponents();

        try {


            JdbcRowSetImpl rowSet = new JdbcRowSetImpl();
             String BB_Name = rowSet.getString("BB_Name");


        } catch (SQLException ex) {
            Logger.getLogger(BB_Value_SearchBox.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
        private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {                                             

        BB_Value_Results BVS = new BB_Value_Results(searchBoxTextField.getText());
        BVS.setVisible(true);
        dispose();
    }                                            

    private void exitButtonActionPerformed(java.awt.event.ActionEvent evt) {                                           
        Main_Page MP = new Main_Page(null);
        MP.setVisible(true);
        dispose();
    }                                          

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(BB_Value_SearchBox.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(BB_Value_SearchBox.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(BB_Value_SearchBox.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(BB_Value_SearchBox.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new BB_Value_SearchBox().setVisible(true);
            }
        });
    }

The Error I am getting when i run it :

BB_Value_SearchBox <init>
SEVERE: null
java.sql.SQLException: Invalid state
    at com.sun.rowset.JdbcRowSetImpl.checkState(JdbcRowSetImpl.java:502)
    at com.sun.rowset.JdbcRowSetImpl.findColumn(JdbcRowSetImpl.java:1680)
    at com.sun.rowset.JdbcRowSetImpl.getString(JdbcRowSetImpl.java:1208)
    at BB_Value_SearchBox.<init>(BB_Value_SearchBox.java:23)
    at BB_Value_SearchBox$3.run(BB_Value_SearchBox.java:167)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Any help will be greatly appreciated. Or if you could just point me in the right direction.

Thanks

You should check the documentation for the JdbcRowSetImpl constructor that you are calling. It is never safe to call any method or constructor without reading the documentation, so it is general good advice to always check the documentation. In this case a quick search found documentation for a com.sun.rowset.JdbcRowSetImpl that would throw a SQLException if you used the no-arguments constructor and then tried to use the JdbcRowSetImpl without first calling execute. I'm not sure that the documentation I found is for the version of the class that you are using, but it would explain your problem.

Figured it out I was being thick! I would delete this question due to its stupidity! but i can't seem to find the place to delete the articles you post haha

i can't seem to find the place to delete the articles you post

There is no such place. You posted a real-life question and someone spent time and effort answering it. Now it's part of our knowledge base where it may help others in future. No way do we want it deleted.
ps: there's no such thing as a stupid question.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.