hi..to all........
i used the following code... in order to check the input with the database...
but i had a error java.sql.SQLExc eption: No data found
i checked the database name... and database connection... i dont know wats wrong ..... plz help me to resolve the problem......
i used the following code... in order to check the input with the database...
but i had a error java.sql.SQLExc eption: No data found
i checked the database name... and database connection... i dont know wats wrong ..... plz help me to resolve the problem......
Code:
try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc:prism"); stmt=con.createStatement(); rs=stmt.executeQuery("select * from Customerdetails"); s1=(ccod.getText()); while(rs.next()) { if(rs.getString("CustomerID").equals(s1)) { flag=1; s1=(rs.getString(1)); s2=(rs.getString(2)); s3=(rs.getString(3)); s4=(rs.getString(4)); s5=(rs.getString(5)); s6=(rs.getString(6)); s7=(rs.getString(7)); JOptionPane.showMessageDialog(this,new String("data found"+rs.getString(1))); ccod.setText(s1); cname.setText(s2); add.setText(s3); phno.setText(s4); conp.setText(s5); email.setText(s6); fax.setText(s7); } } } catch(ClassNotFoundException e) { System.out.println(e); } catch(SQLException e) { System.out.println(e); } }
Comment