I have stored procedure basically I want to get the number of records I selected from a table. because this query doing the same thing from many DB tables. So I want to use tableName as a parameter in stored procedure. and then I want to display this number
on a WEB Page. The stored procedure and code for page is below.
First, I ran stored procedure (exec mystoredprocedure @tableName = 'xxx') it shows a value and it is correct.
then I ran it on the page, it throws exception "object cannot be cast from DBNull to other type" and the value I get returned is null. It is something wrong either in stored procedure or my code for the page. see below:
ALTER PROCEDURE [dbo].[XXX]
(
@numberOfRecords int = NULL OUTPUT,
@tableName nvarchar(15)
)
AS
BEGIN
SET NOCOUNT ON;
...
Go to the complete details ...