2013-03-13 36 views
0

我設計了一個報告(.rdl文件),它有一個參數,我在.net c#中設置該參數並傳遞給reportviewer。如何處理參數未設置爲值的報告。如果參數爲null,我想返回所有行。空reportviewer參數

這是我在報表設計器:

SELECT * 
FROM 
    Users 
WHERE UserID = (@ReportParameter1) 

回答

0

改變的選擇爲:

SELECT * 
FROM 
    Users 
WHERE UserID = (@ReportParameter1) or @ReportParameter1 is null 
+0

我收到此錯誤:'附近有語法錯誤 '=''當我運行應用程序 – mpora 2013-03-13 18:12:40

+0

你的報告是一個rdl或rdlc(在SSRS或本地)? – Byron 2013-03-13 18:17:52

+0

該報告是rdl和本地 – mpora 2013-03-13 18:18:41

0
SELECT * 
FROM 
    Users 
where (@ReportParameter1 is null or UserID [email protected]) 
+0

我確實將該值設置爲true。我正在使用的值來自下拉菜單,現在這是我得到的錯誤:'爲報告參數'ReportParameter1'提供的值對其類型無效。 '當我選擇一個空的項目。 – mpora 2013-03-13 18:22:04