Groups | Blog | Home
all groups > sql server reporting services > september 2004 >

sql server reporting services : Question about a SQL Reporting Tutorial Example


cmay NO[at]SPAM walshgroup.com
9/5/2004 12:23:30 PM
In the BOL "Walkthrough - Using a Dynamic Query in a Report" it says:

In Data view, select the Employees dataset, and then use the generic
query designer to replace the original query with the following
expression:

="SELECT FirstName, LastName, Title FROM Employee" &
IIf(Parameters!Department.Value = 0,""," WHERE (DepartmentID = " &
Parameters!Department.Value & ")") & " ORDER BY LastName"
This expression

If I put that in the generic query designer it will not validate the
SQL.

Robert Bruckner [MSFT]
9/5/2004 5:55:55 PM
Expression-based queries cannot be validated and executed in the generic
query designer, because it does not evaluate the VB.NET expressions. They
are only evaluated at report runtime.

The general recommendation for dynamic queries using VB.NET expressions is
to start with a static query, then add a textbox to the report with the
dynamic query expression you want to use. Run the report to verify that the
expression-based commandtext evaluates to valid SQL, and then in the last
step replace the static query with the dynamic expression-based query. In
addition, the fields list is only auto-detected from non expression-based
queries.

--
This posting is provided "AS IS" with no warranties, and confers no rights.


[quoted text, click to view]

AddThis Social Bookmark Button