I'm attempting to create a parameterized report within a C# application. When I go to the Data Source Designer, I can select preview, and see the appropriate data just fine. However, when I attempt to create a report with the stored procedure, the report ends up being blank, as if no rows are returned
If I create a brand new report, without the parameters, it still returns blank. However, my views and tables pull just fine.
Any ideas?
EDIT
Code Attempt 1
ALTER PROCEDURE [dbo].[getReportData]
@minimumDate DATE = '1900-01-01',
@maximumDate DATE = '2100-12-31',
@PO INT = null,
@glCode INT = null,
@merchant INT = null,
@employee INT = null
AS
BEGIN
SET NOCOUNT ON;
SELECT dbo.transactions.date_purchased,
dbo.transactions.description,
dbo.transactions.purchase_order_number,
dbo.transaction_codes.transaction_code,
dbo.merchants.merchant,
dbo.transactions.amount,
dbo.employees.first_name + ' ' + dbo.employees.last_name AS employee
FROM dbo.transactions
INNER JOIN dbo.transaction_codes ON dbo.transactions.accounting_code = dbo.transaction_codes.id
INNER JOIN dbo.merchants ON dbo.transactions.merchant_id = dbo.merchants.id
INNER JOIN dbo.employees ON dbo.transactions.employee_id = dbo.employees.id
WHERE
(dbo.transactions.date_purchased BETWEEN @minimumDate AND @maximumDate) AND
(@employee IS NULL or dbo.transactions.employee_id IN(@employee)) AND
(@po is null or dbo.transactions.purchase_order_number = @PO) AND (@merchant is null or dbo.transactions.merchant_id IN(@merchant)) AND
(@glCode is null or dbo.transactions.accounting_code IN(@glCode))
END
Without parameters
CREATE PROCEDURE getData
AS
BEGIN
SET NOCOUNT ON;
SELECT dbo.transactions.date_purchased,
dbo.transactions.description,
dbo.transactions.purchase_order_number,
dbo.transaction_codes.transaction_code,
dbo.merchants.merchant,
dbo.transactions.amount,
dbo.employees.first_name + ' ' + dbo.employees.last_name AS employee
FROM dbo.transactions INNER JOIN
dbo.transaction_codes ON dbo.transactions.accounting_code = dbo.transaction_codes.id INNER JOIN
dbo.merchants ON dbo.transactions.merchant_id = dbo.merchants.id INNER JOIN
dbo.employees ON dbo.transactions.employee_id = dbo.employees.id
END
GO
Next thing I would try is a report with an embedded query to see if data is returned. Perhaps, nothing will be returned but something might click for you along the way.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.