我有功能
public IEnumerable<OrderDtoGet> GetLookupOrders(Int64 productId, TableParameters param, Boolean showCompletedOnly, Boolean showDebug, PagingParameters pagingParam)
{
var outParam = new SqlParameter("@TotalRows", 0) { Direction = ParameterDirection.Output };
return UnitOfWork.Context.Database.SqlQuery<OrderDtoGet>("GetOrdersLookup @productId, @showCompletedOnly, @showDebug, @sortField, @searchField, @sortDirect, @TotalRows out, @page, @pagesize",
new SqlParameter("@productID", productId),
new SqlParameter("@showCompletedOnly", showCompletedOnly),
new SqlParameter("@showDebug", showDebug),
new SqlParameter("@sortField", param.SortField),
new SqlParameter("@searchField", param.SearchField),
new SqlParameter("@sortDirect", param.SortDirect),
outParam,
new SqlParameter("@page", pagingParam.currentPage),
new SqlParameter("@pagesize", pagingParam.numberOfEntriesPerPage));
}
我有下一个SP
ALTER PROCEDURE [dbo].[GetOrdersLookup]
@productId int ,
@showCompletedOnly bit ,
@showDebug bit,
@sortField nvarchar(200) ,
@searchField nvarchar(200) ,
@sortDirect nvarchar(200) ,
@TotalRows INT OUTPUT,
@page INT ,
@pagesize INT
AS
BEGIN
declare @result TABLE(OrderId nvarchar(50), OrderNumber nvarchar(50), CustomerName nvarchar(1000),
CustomerLocation nvarchar(1000), [Order] decimal, OrderDate DateTime, IsDebugOrder BIT,
OrderStatus int, OrderValidationResult int, CustomerEmail nvarchar(500), Zip nvarchar(100)
)
...
select @TotalRows = count(*) from @result
select *
from @result
END
除了参数外它工作正常,我无法找到错误的位置。它每次都返回null。任何人都可以帮我吗?