-1

I created a registration form and saved data in database, but it does not retrieve the table:

Here is the Code:

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
     try {
        //con = DriverManager.getConnection("jdbc:mysql://localhost:3306/studreg","root","");
        String sql="select * from newdata where srno=?";
        ResultSet resultSet =null;
        pst=con.prepareStatement(sql);
        pst.setText(1,search.getText());  
        rs =pst.executeQuery();
        if(rs.next()){
            String add1;
             add1 = rs.getString("srno");
            srno.setText(add1);
            String add2=rs.getString("name");
            name.setText(add2);
            String add3=rs.getString("email");
            email.setText(add3);
            String add4=rs.getString("password");
            password.setText(add4);
            String add5=rs.getString("mobleno");
            mobileno.setText(add5);
            String add6=rs.getString("gender");
            gender.setText(add6);
            String add7=rs.getString("country");
            country.setText(add7);
            String add8=rs.getString("refrence");
            refrence.setText(add8);
            String add9=rs.getString("select");
            select.setText(add9);>

I get this error when I try to run it:

Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - cannot find symbol symbol: class preparedStatment location: class newframe.DataSave 
at newframe.DataSave.<init>(DataSave.java:25) 
at newframe.DataSave$3.run(DataSave.java:253) 
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java‌​:251) 
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:701) 
at java.awt.EventQueue.access$000(EventQueue.java:102) 
at java.awt.EventQueue$3.run(EventQueue.java:662) 
at java.awt.EventQueue$3.run(EventQueue.java:660)
at java.security.AccessController.doPrivileged(Native Method) 
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) 
at java.awt.EventQueue.dispatchEvent(EventQueue.java:671) 
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDis‌​patchThread.java:244‌​)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispat‌​chThread.java:163) 
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDis‌​patchThread.java:151‌​) 
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.‌​java:147) 
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.‌​java:139) 
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97‌​)
Roddy of the Frozen Peas
  • 14,380
  • 9
  • 49
  • 99
parag
  • 3
  • 3
  • Please read this before posting: https://stackoverflow.com/help/how-to-ask – Georg Leber Jan 25 '18 at 12:00
  • Pls add the error message and the output of `DESCRIBE newdata` – dcorking Jan 25 '18 at 12:04
  • Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - cannot find symbol symbol: class preparedStatment location: class newframe.DataSave – parag Jan 25 '18 at 12:15
  • at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:671) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244) – parag Jan 25 '18 at 12:16
  • at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) at java.awt.EventDispatchThread.run(EventDispatchThread.java:97) – parag Jan 25 '18 at 12:16
  • Error are this! – parag Jan 25 '18 at 12:17
  • Pls add your error messages to the question; not in comments. – dcorking Jan 25 '18 at 12:24
  • Pls list the import statements in your source file – dcorking Jan 25 '18 at 12:26
  • I have added your error message to your question, @parag. Please use the [edit](https://stackoverflow.com/posts/48442310/edit) button to make changes rather than the 'add comment' box. – Roddy of the Frozen Peas Jan 25 '18 at 18:31
  • Glad you have fixed it. Was the fix the import statement I suggested, or refreshing the netbeans cache? – dcorking Jan 31 '18 at 17:27

1 Answers1

0

This message:

Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - cannot find symbol symbol: class preparedStatment location: class newframe.DataSave

probably means you should add this to your source code:

import java.sql.PreparedStatement;
dcorking
  • 1,146
  • 1
  • 14
  • 24