Posts mit dem Label PowerShell werden angezeigt. Alle Posts anzeigen
Posts mit dem Label PowerShell werden angezeigt. Alle Posts anzeigen

Samstag, 17. Juli 2010

Use SSRS ReportViewer with PowerShell, use parameters and catch navigate event

Today I will just show a small extension of code from @sqlbelle which you find at SQL Server PowerShell : How to View your SSRS Reports (rdl) Using PowerShell and ReportViewer

Thanks belle, your code gave me a great start to  build a prototyp and evaluate the ReportViewer Control. I had to add an eventhandler for the hyperlink event and to provide reportparameters by code.

As I didn't find these features in PowerShell Examples and I found the translating of C# not trivial, I present here my code.

Thanks go to James Kovacs for the C# example for Reportparameters

James Brundage how showed me how to write an eventhandler in PowerShell

and somewhere in Bruce Payette's Windows PowerShell in Action I found the solution for defining the array of .Net Objects, which I need here for  Report Parameters.

hope it helps

Bernd

Edited:
Oops I had still formating difficulties in this blog.
You find the same code at http://poshcode.org/1977.

Sonntag, 9. Mai 2010

About the use of SQL-Server Print Statement

In the old days, when I did my ad-hoc SQL using T-SQL in the Query-Analyzer, it was natural to use print statements, when to give back some feedback to the user.

Today using SQL-Server Management Studio, half the time I display the results in grid and as long as it looks reasonable, I won't switch to the message tab.

With SQL-Server the use  print in T-SQL is rather easy. While in former days you could only emit one string or variable, with todays versions you can use expressions.

I'm not going to speak about Orcales DBMS_OUTPUT package in length here. Remember SET server output on. And OK with 10 g they even got SET SERVEROUTPUT ON SIZE UNLIMITED, i.e. it became an option to use.

But acessing your database from applications or a PowerShell module like SQLPSX,it becomes more difficult to collect the print output.
For SQL-Server it would be possible, that means I know code to get the output.
While with Oracle I have only some vague ideas, how to do it (requiring to use connections) .

Conculsion: I'm starting to rewrite my scripts, using select @msg msg instead of print @msg.

Bernd