all groups > sql server reporting services > april 2005 >
You're in the

sql server reporting services

group:

Query String Programmatically


Query String Programmatically Edgar Mantilla via SQLMonster.com
4/19/2005 11:26:17 PM
sql server reporting services:
Is any way to Modified The Query String Programmatically for a Report ?
I want to be able to Change the WHERE Clause without using Parameter..
e.i WHERE DeliveryDate = '2005-04-04' but the next time I run the report I
want something like WHERE DeliveryDate < '2005-04-04'.
Thank. Any Idea I would appreciated.

--
Re: Query String Programmatically Ted K
4/20/2005 11:32:04 AM
Edgar,
AFAIK you can't change the query text at report run time. There are
solutions to this type of complex querying, and let me say up front that I
recommend you put your query in a stored procedure instead of trying to put
this all into the report itself.

As Jens said, you can use dynamic SQL. This involves building your query as
a string and then calling EXEC (string). If you only have a limited number
of choices (e.g. only <, =, or >) then you can simply use IF statements and
hard code the queries for each branch.

Note: if you go the dynamic SQL route, beware of SQL injection attacks.
That's a whole subject, and too much to discuss here in one post.

Ted

[quoted text, click to view]
Re: Query String Programmatically Jens Süßmeyer
4/20/2005 2:20:20 PM
Got from BOL.

Passing a Report Parameter on a URL
You can pass report parameters to a report by including them in a URL. These
URL parameters are not prefixed, because they are passed directly to the
report processing engine. For more about report parameters, see Running a
Parameterized Report.

Example
The following example uses the report parameter EmployeeID to render the
specified report:

http://server/reportserver?/Sales/Northwest/Employee Sales
Report&rs:Command=Render&EmployeeID=1234See Also

The operator cant be changed unless you use dynamic SQL.

HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---
"Edgar Mantilla via SQLMonster.com" <forum@nospam.SQLMonster.com> schrieb im
Newsbeitrag news:000edb152d5c494b8854daa6aaf009ff@SQLMonster.com...
[quoted text, click to view]

Re: Query String Programmatically Edgar Mantilla via SQLMonster.com
4/20/2005 3:12:18 PM
Thank you,
I am working in a windows form that selects the report from the Report
Server and send it as .PDF to a specific location, Passing a Report
Parameter on a URL, it works well, but I want to have more flexibility in
building my query string, so I worked with a RDL Generator (Form BOL
Walkthrough – Generating RDL Using the .NET Framework), which work fine
when you are creating a report from scratch.

Is any way to change the CommandTex or Query string of an existing report
programmatically?

--
RE: Query String Programmatically Rachel
5/10/2005 9:01:13 AM
Hi, in the Generic Query Designer you can use some like this:

="SELECT " & Parameters!Field1.Value
" FROM " &
Parameters!Table.Value


[quoted text, click to view]
AddThis Social Bookmark Button