G
Guest
Hello!
I'm using SQL Server 2005. I have Stored Procedure that returns Table
Records and RowCount as output parameter:
CREATE PROCEDURE [dbo].[GetListByPage]
@RecordCount bigint OUTPUT
AS
BEGIN
-- get record count
SELECT @RecordCount = (SELECT COUNT(ProductId) FROM [StoreProducts])
-- get table
SELECT * FROM StoreProducts
END
I'm using DAAB to get data from the procedure, but Output parameter returns
nothing.
The only time it returns a result if I don't use second Sql Statement in
procedure that actually returns table. Am I doing something wrong? Any ideas?
Thanks !
Code :
Dim db As Database = DatabaseFactory.CreateDatabase()
'
Dim proc As String = "GetListByPage"
Dim cmd As DbCommand = db.GetStoredProcCommand(proc)
'
db.AddOutParameter(cmd, "@RecordCount", DbType.Int64, 0)
Dim dataReader As IDataReader = db.ExecuteReader(cmd)
Dim o As Object = db.GetParameterValue(cmd, "@RecordCount")
I'm using SQL Server 2005. I have Stored Procedure that returns Table
Records and RowCount as output parameter:
CREATE PROCEDURE [dbo].[GetListByPage]
@RecordCount bigint OUTPUT
AS
BEGIN
-- get record count
SELECT @RecordCount = (SELECT COUNT(ProductId) FROM [StoreProducts])
-- get table
SELECT * FROM StoreProducts
END
I'm using DAAB to get data from the procedure, but Output parameter returns
nothing.
The only time it returns a result if I don't use second Sql Statement in
procedure that actually returns table. Am I doing something wrong? Any ideas?
Thanks !
Code :
Dim db As Database = DatabaseFactory.CreateDatabase()
'
Dim proc As String = "GetListByPage"
Dim cmd As DbCommand = db.GetStoredProcCommand(proc)
'
db.AddOutParameter(cmd, "@RecordCount", DbType.Int64, 0)
Dim dataReader As IDataReader = db.ExecuteReader(cmd)
Dim o As Object = db.GetParameterValue(cmd, "@RecordCount")