Ma procédure stockée est comme ceci.Comment obtenir le paramètre de sortie de sql dans codebehind
ALTER PROCEDURE [dbo].[GetImagesByDesignId]
@DesignID bigint,
@RegID bigint,
@PageIndex INT,
@NumRows INT,
@ImageCount INT OUTPUT
AS
BEGIN
SELECT @ImageCount=(SELECT COUNT(*) FROM DocManagement where [email protected] and [email protected])
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 [email protected] and [email protected]
)
Select RegID, DesignID,ImageName
FROM ImageEntries
WHERE Row between
@startRowIndex and @[email protected]
END
J'appelle StoredProcedure dans mon codebehind comme
Dim dt As DataTable = objUpload.GetDocuments(lngRegID, lngDesignID)
dlView.DataSource = dt
dlView.DataBind()
dlView est datalist.Method GetDocuments est écrit dans une autre classe comme celui-ci
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
problème est que je veux datattable comme ainsi que l'imagecount dans codebehind.Comment puis-je retourner datatable et imagecount à codebehind.Can quelqu'un peut-il aider?