all groups > sql server reporting services > october 2007 >
You're in the

sql server reporting services

group:

loading a report in a windows application using reportviewer


loading a report in a windows application using reportviewer billyburditt NO[at]SPAM gmail.com
10/31/2007 10:56:13 AM
sql server reporting services: I have a windows application which displays a remote report using the
reportviewer. It works fine except on the form load it runs the
report. I rather the report just display instead of running. This is
a problem for two reasons:

1. My report has parameters. Since no parameters have been chosen,
the report runs with an error "The 'parametername' is missing a
value". I'd rather let the user choose the parameters and then run
the report.

2. Since the report runs on the form load event, it takes a long time
for my form to load.

Is there a way to just display the report without running it? If I
exclude Me.ReportViewer1.RefreshReport() on the load event, the
reportviewer is blank. Is there another method I could use?

This seems like it would really easy, but I can't find anything.
Thanks for your help.

Billy
Re: loading a report in a windows application using reportviewer Norman Yuan
10/31/2007 1:08:58 PM
You could simply add a local report that shows some static information (so
it loads quickly) to your project and has it loaded when the form is
loading. Then on the form, you provide ways for user to input report
parameters and only then load remote reports from reporting services server.


[quoted text, click to view]
Re: loading a report in a windows application using reportviewer billyburditt NO[at]SPAM gmail.com
11/1/2007 8:13:19 AM
[quoted text, click to view]

So there's no way to just load a remote report instead of running it?
That seems strange.
Re: loading a report in a windows application using reportviewer Bruce L-C [MVP]
11/1/2007 10:29:33 AM
I am using the control and using it with remote controls. The report does
not run automatically unless the report on the server either has no
parameters or if the parameters all have defaults (i.e. the same behavior if
you were running the report from Report Manager). I am not getting an error.
Are you showing the parameters area? I have a single form with the
reportviewer control. f is the form with the reportviewer control.
f.ReportViewer1.ServerReport.ReportPath = ReportName

The user enters parameters just like if they were using Report Manager. Are
you hiding the parameter section and then calling SetParameters?

You are doing something out of sequence. You can definitely use the control
where you do not get an attempt at rendering before you want it to (with the
caveat that one of your parameters on the report must not have a default
assigned to it).

--
Bruce Loehle-Conger
MVP SQL Server Reporting Services



[quoted text, click to view]

Re: loading a report in a windows application using reportviewer billyburditt NO[at]SPAM gmail.com
11/2/2007 7:25:43 AM
On Nov 1, 10:29 am, "Bruce L-C [MVP]" <bruce_lcNOS...@hotmail.com>
[quoted text, click to view]

I still can't get this to work. I removed all parameter default
values in my report, and it's still tries to run the report on the
load event. (Previously, only some parameters had defaults, but I
removed all to see if that would make a difference.)

When I created my reports I didn't write any code. I just dragged the
reportviewer on the form, and set all the properties in design mode.
You can set the Processing Mode, ReportPath, ReportServerUrl through
the properties window in designer. Once you place a reportview on a
form, it automatically inserts Me.ReportViewer1.RefreshReport() on the
load event.

Should I set the properties in runtime instead of design mode? If so,
what order should I set those properties?





Re: loading a report in a windows application using reportviewer billyburditt NO[at]SPAM gmail.com
11/2/2007 3:04:50 PM
On Nov 2, 4:11 pm, "Bruce L-C [MVP]" <bruce_lcNOS...@hotmail.com>
[quoted text, click to view]

When I remove that line, my report doesn't show at all. I just get a
disabled reportview toolbar (navigation, print, export, etc). Is
there another line of code that needs to be added to load the report?

Re: loading a report in a windows application using reportviewer Bruce L-C [MVP]
11/2/2007 4:11:42 PM
Try commenting out this line:
Me.ReportViewer1.RefreshReport()

I am pretty sure that it isn't needed. That it causes the report to run.
Then when they select the parameters and run the report it should work for
you.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services



[quoted text, click to view]

AddThis Social Bookmark Button