if statements?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having problems making a question work.

I have a vb6 function I am porting to C# (still very new to CSharp) and am
not able to make sense of this. Any feedback would be appreciated!

one is - how do I replicate this in C# I need to ask this service if this is
more than null then die

if surveyNum <> "" then
exit function
end if

my second glitch comes from - I keep getting a message about string and bool
when I am trying to see if the field is null and if not then append to
sqlstring

if DataVars.surveyType <> "" then
strSQL = yahayahaha
end if

How do I kill a function once it starts and gets to this section?

Thanks
 
sorry first one should be like this, if surveyNum is a number

if(surveyNum == null || surveyNum > 0)
return;
 
Thanks for Kurt's inputs,

Hi DEWright_CA,

In C# , if we want to check whether a string is null or empty we can use
the following statment:

string str.....

if(str == null || str == string.Empty)
{
...........
}

Also, as Kurt has mentioned, to exit a function in C# , we just use the
"return" as in c/c++

HTH.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top