views:

34

answers:

1

I greatly thanks those that reply to my question "main method not found error", after correcting all the parenthesis and it seem the code is alright.On the IDE its still indicate the error below;

             private javax.swing.JButton jButton1;
             private javax.swing.JComboBox jComboBox1;
             private javax.swing.JLabel jLabel1;
             private javax.swing.JLabel jLabel2;
             private javax.swing.JLabel jLabel3;
             private javax.swing.JLabel jLabel4;
             private javax.swing.JTextField jTextField1;
             private javax.swing.JTextField jTextField2;
error line** private javax.swing.JTextField jTextField3;

i.e build failed indicating the only error line above and thus, those are variable declararation by the IDE and it cannot be modify.

The main code is;

  private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        try {
            DriverManager.registerDriver(new org.apache.derby.jdbc.ClientDriver());
            Connection conn=DriverManager.getConnection("jdbc:derby://localhost:1527/sample","app","app");
            preparedStatement ps=conn.prepareStatement("select name,zip,discount_code from customer where customer_id=?");
            ps.setInt(1,Interger.parseInt(jTextField1.getText()));
            ResultSet rs=ps.executeQuery();
            if(rs.next()) { 
                jTextField2.setText(rs.getString(1));
                jTextField3.setText(rs.getString(2));
                jComboBox1.setSelectedItem(rs.getString(3));
    }                                        
        } catch (NumberFormatException ex) {
            ex.PrintStackTrace();
        }catch (SQLException ex){
            ex.printStackTrace();
        }
    }
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new jdfrm().setVisible(true);
                }
+2  A: 

Currently, the only problem i can see is that preparedStatement should be PreparedStatement, yes with the capital P, instead.

There is also a closing curly brace missing after the main method, but maybe tou did not copy paste all your code ...

chburd
@Olumide: If this solves your problem, then please let us know what IDE you are using, so we don't recommend that to anyone.
Adeel Ansari