Stored Procedure return values - Test for DBNull - ASP.NET

From: Greg R (anonymous_at_discussions.microsoft.com)
Date: 03/25/04


Date: Wed, 24 Mar 2004 20:06:08 -0800

mystring = (string)parameter.Value; (ASP.NET, C#, MSSQL)

from: sqlcommand output parameter, this returns an error when the Value is null.

Is there a way to test for DBNull on an output string parameter in C# ?

On a page load I am trying to fill a textbox control with text from an MSSQL table. Using a stored procedure I get an error when trying to read the table before it is filled.

If there is not a way to test for a null string, what is the work around?

Thanks,

Greg R