hi guys, My stored procedure is like this.
ALTER PROCEDURE [dbo].[GetImagesByDesignId]
@DesignID bigint,
@RegID bigint,
@PageIndex INT,
@NumRows INT,
@ImageCount INT OUTPUT
AS
BEGIN
SELECT @ImageCount=(SELECT COUNT(*) FROM DocManagement where DesignID=@DesignID and RegID=@RegID)
Declare @startRowIndex INT;
set @startRowIndex = (@PageIndex * @NumRows) + 1;
With ImageEntries as (
SELECT ROW_NUMBER() OVER (ORDER BY DocumentID ASC) as Row, RegID, DesignID,ImageName
FROM DocManagement
WHERE DesignID=@DesignID and RegID=@RegID
)
Select RegID, DesignID,ImageName
FROM ImageEntries
WHERE Row between
@startRowIndex and @StartRowIndex+@NumRows-1
END
I am calling storedprocedure in my codebehind as
Dim dt As DataTable = objUpload.GetDocuments(lngRegID, lngDesignID)
dlView.DataSource = dt
dlView.DataBind()
dlView is datalist.Method GetDocuments is written in another class like this
Public Function GetDocuments(ByVal lngRegID As Long, ByVal lngDesID As Long) As DataTable
Try
Dim db As Database = DatabaseFactory.CreateDatabase()
Dim DbCommand As DbCommand = db.GetStoredProcCommand("GetImagesByDesignId")
db.AddInParameter(DbCommand, "@RegID", DbType.Int64, lngRegID)
db.AddInParameter(DbCommand, "@DesignID", DbType.Int64, lngDesID)
db.AddInParameter(DbCommand, "@PageIndex ", DbType.Int32, intPageIndex)
db.AddInParameter(DbCommand, "@NumRows ", DbType.Int32, intNumRows)
db.AddOutParameter(DbCommand, "ImageCount", DbType.Int32, 250)
Return db.ExecuteDataSet(DbCommand).Tables(0)
Dim strOutput() As String = {db.GetParameterValue(DbCommand, "ImageCount").ToString}
Catch ex As Exception
End Try
End Function
Problem is i want to get datattable as well as imagecount in codebehind.How can i return back datatable and imagecount to codebehind.Can anybody help?