General information
Category:
Coding, syntax and commands
Title:
Return Error from Stored Procedure with Executescalar
Hi.
I have the code below, which is going into the Catch Bit, but I dont know why (It does not like the ExecuteScalar bit).
Is there a way of returning the Error from a stored procedure when using an ExecuteScalar
My Stored procedure is like:
Select Sum(MyBalance) as MyBal From MyTable
(It works fine in SSMS)
Tia
Gerard
----------------------------------------------------------------------------------------------
try
{
// --- initialization stuff for com ---
com.CommandType = CommandType.StoredProcedure;
decimal dec = (decimal)com.ExecuteScalar();
com.ExecuteScalar(); // E R R O R S O U T H E R E B U T D O N T K N O W W H Y
}
catch
{ MessageBox.Show("There has been an error "); }
-----------------------------------------------------------------------------------------------
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only