Click here to Skip to main content
15,903,012 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have implemented a program which contains desktop application form with several textboxes.

now when i run my application from netbeans.
first it will display two textboxes to type
username and passwords.
and there two buttons to submit and cancel

also i have mysql database called entry.
there is a table called users?
user contains usernames and passwords.

when user type their user name and passwords
application should compare that usernames and passwords with database.
if its correct application should throw a message saying password successful.

here is my code for that:

C#
String boxer = "bob";
while (rs.next()){
    
     String u_1name = rs.getString("username");
     String u_2name = rs.getString("password");
     //String boxer = "bob";
     //Visa_Request newvisa = new Visa_Request();
     if (u_1name==boxer){
     
     //LoginClass Log = new LoginClass();
   //  String u_2name = Log.getUname();
     System.out.println(u_2name);
     JOptionPane.showMessageDialog(null,"successfully completed","This is supposed to be the MessageBox title.",JOptionPane.INFORMATION_MESSAGE);
  }
 }


this is an example..
without user inputs.. i have created static variable called boxer to test.
my if condition will compare that database value with boxer.

if its okay then it will throw a successful message.

but here in my example, it won't give any message.
i think my code is wrong.

please let me know the way of doing this?
Posted
Comments
Richard MacCutchan 27-Nov-15 3:28am    
Use the debugger to step through the code and check the values of the variables.
Hemas Ilearn 27-Nov-15 3:32am    
those are okay......

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900