P
Phill
I have a SQL Server stored procedure that returns an int. Sometimes a
null value is returned which causes the problem.
//This is what I did:
return (int)cmd.Parameters["nextCount"].Value;
//What I should do is this:
if( cmd.Parameters["nextCount"].Value != DBNull.Value )
{
return (int)cmd.Parameters["nextCount"].Value;
}
The only way I see the exception is when I run the program w/
debugging. Because the program seems to hang on that line and keeps
sucking up memory unless I kill it. I thought (even if running w/o
debugging) an exception would halt the program and since I have no
catch blocks should stop the program and display an exception. But the
program keeps running in task manager and keeps sucking up a little
more memory all the time?
Why is this?
Thank you for any help.
null value is returned which causes the problem.
//This is what I did:
return (int)cmd.Parameters["nextCount"].Value;
//What I should do is this:
if( cmd.Parameters["nextCount"].Value != DBNull.Value )
{
return (int)cmd.Parameters["nextCount"].Value;
}
The only way I see the exception is when I run the program w/
debugging. Because the program seems to hang on that line and keeps
sucking up memory unless I kill it. I thought (even if running w/o
debugging) an exception would halt the program and since I have no
catch blocks should stop the program and display an exception. But the
program keeps running in task manager and keeps sucking up a little
more memory all the time?
Why is this?
Thank you for any help.