i am trying to create a simple signup form in java. I have made a table in sql in which i have selected not to allow null values but when i signup without entering any values no exception is being given .... all the null values are being excepted..!! What should i do?
private void b1ActionPerformed(java.awt.event.ActionEventevt) {
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:mydsn1");
PreparedStatement pstmt= con.prepareStatement("insert into project.dbo.signup values(?,?,?,?,?,?)");
pstmt.setString(1,t1.getText());
pstmt.setString(2,t2.getText());
pstmt.setString(3,String.valueOf(t3.getText()));
pstmt.setString(4,t4.getText());
pstmt.setString(5,t5.getText());
pstmt.setString(6,c1.getSelectedItem().toString());
pstmt.executeUpdate();
}
catch(SQLException e)
{
JOptionPane.showMessageDialog(null,e.toString());
}
catch(Exception ob)
{
JOptionPane.showMessageDialog(null,ob.toString());
}
}