Problem Using Relational Operators !!
The code given under is not working corretly. The problem is stated as comments in the program.
if(result.next())
{
String temp_no=t_no.getText();
String temp_nm=t_name.getText();
String temp_result1= result.getString(2);
String temp_result2= result.getString(3);
if(temp_no!=temp_result1)// The condition is always true.Even if i give the same no & name as in database!! Why is it so?
{
JOptionPane.showMessageDialog(cdFrame,new String("There Is No Disc With The Specified Number !!"));
}
else
if(temp_nm!=temp_result2)
{
JOptionPane.showMessageDialog(cdFrame,new String("There Is No Disc With The Specified Name !!"));
}
else
{
upd.executeUpdate();
JOptionPane.showMessageDialog(cdFrame,new String("DATA HAS BEEN UPDATED !!"));
}
}
else
{
JOptionPane.showMessageDialog(cdFrame,new String("There Is No Such Disc As Stated In Old Data !!"));
}
The Program compiles properly and gives no runtime error. What's the problem!!

