aspose file tools*
The moose likes JDBC and the fly likes comparing values from database and from a textbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "comparing values from database and from a textbox" Watch "comparing values from database and from a textbox" New topic
Author

comparing values from database and from a textbox

abhishek rathur
Ranch Hand

Joined: Jan 14, 2010
Posts: 66


The thing is its not going inside the give if loop,however all the 4 values str1,str2,val1,val2 are being printed correctly.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

You are comparing strings using "==" ?


[My Blog]
All roads lead to JavaRanch
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

And please UseCodeTags the next time you want to post some code.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

Please try using: if ( val1.equals(str1)) instead of if ( val1==str1). The former will check for the similarity of the values but the latter will only check if both the variables point/refer to the same string.


Mohamed Sanaulla | My Blog
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Mohamed Sanaulla wrote:Please try using: if ( val1.equals(str1)) instead of if ( val1==str1). The former will check for the similarity of the values but the latter will only check if both the variables point/refer to the same string.

I wish the original poster would have figured that by himself...
abhishek rathur
Ranch Hand

Joined: Jan 14, 2010
Posts: 66
ok ,i got that.Thank you Christophe Verré and Mohamed Sanaulla
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

Christophe Verré wrote:
Mohamed Sanaulla wrote:Please try using: if ( val1.equals(str1)) instead of if ( val1==str1). The former will check for the similarity of the values but the latter will only check if both the variables point/refer to the same string.

I wish the original poster would have figured that by himself...


Yeah, my mistake. I realized after posting the reply
abhishek rathur
Ranch Hand

Joined: Jan 14, 2010
Posts: 66
its working.Actually i am creating a desktop application,i have create a login panel ,what i want is to navigate from this login panel to other panel.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: comparing values from database and from a textbox