What is wrong with my codeing. When I select the search button via my GUI, the GUI dissappears, it doesn't even go to the catch dialog. But when I copy and paste my search query to MySQL it works normally. Please explain.
Here is my code:
[CODE=java]If (source == searchB)
{
try
{
query = "SELECT Telephone,Book, Date from loan WHERE Name = ' " +
nameT.getText() + " ' ";
rs = stmt.executeQue ry(query);
rs.next();
TelT.setText(rs .getString("Tel ephone"));
bookT.setText(r s.getString("Da te"));
dateT.setText(r s.getString("Da te"));
}
catch(SQL Exception sql)
{
JOptionPane.sho wMessageDialog( this,"Details not found");
}
}
[/code]
Thank you in advance.
Petra
Here is my code:
[CODE=java]If (source == searchB)
{
try
{
query = "SELECT Telephone,Book, Date from loan WHERE Name = ' " +
nameT.getText() + " ' ";
rs = stmt.executeQue ry(query);
rs.next();
TelT.setText(rs .getString("Tel ephone"));
bookT.setText(r s.getString("Da te"));
dateT.setText(r s.getString("Da te"));
}
catch(SQL Exception sql)
{
JOptionPane.sho wMessageDialog( this,"Details not found");
}
}
[/code]
Thank you in advance.
Petra
Comment