为什么我的数据集预览没有显示我的存储过程中的数据?

时间:2016-03-01 15:54:41

标签: c# sql-server stored-procedures dataset

即使我预览数据集并输入所需的参数,我也无法返回数据集上的数据。但是当转到数据集所指向的存储过程时,它将显示数据。

这是我的数据集预览数据:

Dataset

这是我的数据集所连接的存储过程:

Stored procedure

WHERE语句值相同

修改

这是我的存储过程

ALTER PROCEDURE [dbo].[sp_viewTerminalXZSupport]
    @ReadingDate Datetime,
    @machine     varchar
AS
BEGIN
    SET NOCOUNT ON;

    SELECT  
        h.Machine,
        CAST(h.DateStamp AS DATE) as DateTran,
        SalesInvoice,
        SUM(i.Quantity) totalquantity, 
        SUM(i.TotalAmount) totalnetamaount,
        SUM(IIF(i.quantity > 0, i.VATableSalesOntotalAmount, 0)) AS VATableSalesOntotalAmount,
        SUM(i.TotalAmount - i.VATableSalesOntotalAmount) AS VatAmount,
        SUM(IIF(i.quantity > 0, i.Quantity, 0)) AS SalesQty,
        SUM(IIF(i.quantity > 0, i.Quantity * i.Soldsrp, 0)) AS SalesGross,
        SUM(IIF(i.quantity > 0, i.DiscountAmount, 0)) AS SalesDiscount,
        SUM(IIF(i.quantity > 0, i.TotalAmount, 0)) AS SalesACD,
        SUM(IIF(i.quantity > 0, i.VatExcemptGrossSales, 0)) AS VatExcemptGrossSales,
        SUM(IIF(i.quantity > 0, i.NonVatGrossSales, 0)) AS NonVATGrossSales,
        SUM(IIF(i.quantity > 0, i.ZeroRatedGrossSales , 0)) AS ZeroRatedGrossSales,
        IIF(m.code = 'CASH', sp.Amount, 0.00) AS TotalCash, 
        IIF(m.code = 'AMEX', sp.Amount, 0.00) AS TotalAMEX,
        IIF(m.code = 'MSTR', sp.Amount, 0.00) AS TotalMSTR,
        IIF(m.code = 'VISA', sp.Amount, 0.00) AS TotalVISA,
        IIF(m.code = 'BITC', sp.Amount, 0.00) AS TotalBitCoin,
        IIF(m.code = 'EPS', sp.Amount, 0.00) AS TotalEPS,
        IIF(m.code = 'LOYAL1', sp.Amount, 0.00) AS TotalLoyal1,
        IIF(m.code = 'GC1', sp.Amount, 0.00) AS GC1
    FROM
        CSHR_SalesItems i
    INNER JOIN 
        CSHR_SalesHeader h ON h.SalesOrderNum = i.SalesOrderNum
    INNER JOIN 
        PAYMENT_SalesPayment sp ON sp.SalesOrderNum = i.SalesOrderNum
    INNER JOIN
        PAYMENT_Methods m ON m.id = sp.MethodID 
    --where     
    --    CAST(h.DateStamp AS DATE) = @ReadingDate AND i.Machine = @machine
    WHERE
        CAST(h.DateStamp AS DATE) = '2016-03-01' 
        AND i.Machine = 'DESKTOP-SRJ101J'
    GROUP BY
        h.Machine, CAST(h.DateStamp AS DATE),
        SalesInvoice, sp.Amount, m.Code
END

0 个答案:

没有答案