HighTechTalks DotNet Forums  

If comparison doesn't work?

Dotnet VJSharp microsoft.public.dotnet.vjsharp


Discuss If comparison doesn't work? in the Dotnet VJSharp forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Christian-Josef Schrattenthaler
 
Posts: n/a

Default If comparison doesn't work? - 05-17-2005 , 05:05 AM






Hello!

I have to following problem: With the call of the website there must be
a parameter ?id=1 (or any other number).

The website must check, if there is an ID (this works), an then, the
website have to check the ID number and do some code spcialy for the
number.

But the comparison doesn't work:

// Create a variable with the worth of ID:
String vjsID = get_Request().get_QueryString().get_Item("id");
// This works!

// Write the worth of the new varible on the screen:
get_Response().Write("Hier die übergebene ID: " +vjsID);
// This works!

// Now make a check:
if (vjsID == "1") {
get_Response().Write("You entered number 1.");
} else {
get_Response().Write("You did not enter a correct number.");
}
// This doen't work, because every time the ELSE function is choosen.

Please help me, and tell me where i made the mistake...

Thanks,
christian.


Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: If comparison doesn't work? - 05-17-2005 , 11:59 AM






Maybe the reference comparison of the strings is the proble. Try
replacing vjsID == "1" with vjsID.equals("1") or "1".equals(vjsID).

Thanks,
Gopi[MSFT]


Reply With Quote
  #3  
Old   
Christian-Josef Schrattenthaler
 
Posts: n/a

Default Re: If comparison doesn't work? - 05-18-2005 , 03:28 AM



Thats it, now it works.
Thanks!

<gopikrishnam (AT) gmail (DOT) com> schrieb im Newsbeitrag
news:1116345565.513940.209250 (AT) g49g2000cwa (DOT) googlegroups.com...
Quote:
Maybe the reference comparison of the strings is the proble. Try
replacing vjsID == "1" with vjsID.equals("1") or "1".equals(vjsID).

Thanks,
Gopi[MSFT]



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.