I have a problem about if else usage in java with mysql.
My code is :
if (!result29.next() )
{
System.out.println("No data");
}
else {
do {
if(name1.equals(result29.getString("name2")))
{
//screen one
namedelete as = new namedelete();
as.setVisible(true);
}
else
{
//screen two
nameadd aek = new nameadd();
aek.setVisible(true);
}
} while (result29.next());
}
If I try to shortly tell this code, if name2 (a mysql colum result) equal to name1 (an entry value) opening the screen one, if not equal it is opening the screen two.
Problem
The problem is, if they are equal, screen one and screen two both opening. But, if not equal it is working normal, just screen two opening.
Can you help me, how can I fix that problem ?