This is an assignment and so far this is what i have done:
on this button click i want to compare user input on the textfield with the data in my database.this is my code but nothing is happening when i run it and i cant find any mistakes in this. i have been trying to figure it out for hours but couldnt find any solution. can u please help me figure out whats wrong with it?
on this button click i want to compare user input on the textfield with the data in my database.this is my code but nothing is happening when i run it and i cant find any mistakes in this. i have been trying to figure it out for hours but couldnt find any solution. can u please help me figure out whats wrong with it?
C++:
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {
try{
String s1 = s1_TextField.getText();
String sql ="select s_no from people where s_no='" + s1 + "'";
rs= st.executeQuery(sql);
int c=0;
while (rs.next())
{
c=c+1;
}
if(c==1)
{
JOptionPane.showMessageDialog(null,"user found");
}
else
{
JOptionPane.showMessageDialog(null,"Incorrect number");
}
}
catch(Exception ex)
{
}
}