Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Testing if a Command return Nothing
Message
From
29/10/2007 09:00:08
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
 
To
26/10/2007 20:07:31
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
VB 8.0
Miscellaneous
Thread ID:
01264340
Message ID:
01264705
Views:
10
Wow, it was Friday and I had turned my brain off for the weekend. Thanks!

>That all depends ... does it return nothing if there's a problem or does it throw an exception? (I don't use ExecuteScalar, so I'm not sure).
>
>If it throws an exception, then you'll have to use a try/catch.
>
>If it just returns nothing, then I'd do this:
>
>result = cmd.ExecuteScalar()
>if (result is not nothing) 'is this correct VB syntax?
>    result = result.ToString
>else
>    result = ""
>endif
>
>
>~~Bonnie
>
>
>
>>Is there a graceful way of modifying the following line of code to test if the Command returns Nothing (besides catching the Exception thrown)?
>>
>>
>>result = cmd.ExecuteScalar().ToString
>>
Very fitting: http://xkcd.com/386/
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform