I am trying to write a SQL query that will return a record count to my C#
application. I wrote the following query:
ALTER PROCEDURE up_justificatio n_duplicate
AS
SELECT COUNT(*)
FROM tblJustificatio ns
RETURN COUNT(*)
The table has four records in it. Running the query in the IDE gets me the
following results:
Running dbo."up_justifi cation_duplicat e".
-----------
4
No more results.
(1 row(s) returned)
@RETURN_VALUE = 1
Finished running dbo."up_justifi cation_duplicat e".
I have tried to extract the count in my application but all I know how to do
is read the return value (always a 1) with a statement like "x =
da.SelectComman d.Parameters[0].Value.ToString ();".
How do I get back the correct count, in this case 4?
Any help is greatly appreciated.