问题
The following picture shows the query and its result with no variables:
The next one shows the same query with a variable and a different result:
This how the parameter was set just before the query execution:
I have also tried setting the parameter without '' but it produces the same result.
Any clue about what's going on? Any help would be greatly appreciated.
NOTE: The DBMS is MySql
回答1:
This weird issue is due to the fact that SSRS is connected to MySQL by ODBC connector; therefore, the query parameters should be defined as ?
and their names are Parameter1
, Parameter2
, etc... in order of appearance
Source: http://www.tek-tips.com/viewthread.cfm?qid=1354185
回答2:
In Report Builder 3.0 you can user parameters in a dataset query using the following syntax: WHERE sql_column_name = (@Parameter_name_in_ReportBuilder)
Example: SELECT * from [dbName].[dbo].[TableName] WHERE Account=(@Parameter1)
Before you can run the report, you need to configure a paramter named Parameter1 (in this example, change this to the name of your parameter) in Dataset Properties - Parameters. The value field should be set to one of the parameters
来源:https://stackoverflow.com/questions/10814477/dataset-query-with-parameters-does-not-work-in-report-builder