How to handle null value
I got trouble with System.Null.ReferenceException. Please guide me how to manipulate it.
Below is my error code line, when the result of my query returns null value.
string FATypeName = SelectCommand.ExecuteScalar().ToString().Trim();
Thanks,
string FATypeName = SelectCommand.ExecuteScalar()
if ( FATypeName!=null )
{
FATypeName=FATypeName.ToString().Trim();
}
else
{
FATypeName=String.Empty;
}
Labels: ado, below, code, error, guide, handle, line, manipulate, net, null, query, referenceexception, system, trouble, value
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home