We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Pass VB form parameters to ssrs report

Medium Priority
1,172 Views
Last Modified: 2013-11-26
I have a report deployed to my 2005 ssrs server which has two parameters, a client number and a date.  The report runs fine in the web browser and I also have linked to the report from my application which I am developing in Visual Studio 2008.  I did this by creating a simple form with a Report Viewer component, referencing the report server url and path to the report file.

I am very new to programming and need some assistance in generating the report from a vb form with a text field for each parameter.  Can you provide me with some sample code that could help me to acheive this?
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
Are you talking about .rdl files, or .rdlc files?  Local reports or server reports?  How are you defining and using the reports?
schwientekdIT Director

Author

Commented:
The report is an rdl.  I am creating the reports in VS 2005 and the solution in VB 2008.  They are server reports.  I have sql 2005 installed localy and will deploy them to a production server.  The report parameters are defined in the report data source sql query using @parameter.  Currently I have to enter the values in the text boxes at the top in order to run the report.  I am hoping to find a way to pass these values from a form built in the VS 2008 solution but I am not sure of how to write the correct code.  This is the beginning of a new project for me and I need a sort of jump start to get going.
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
Would a reference like this help?

Using Report Parameters in SQL Server Reporting Services
http://www.sql-server-performance.com/articles/reporting/report_parameters_p1.aspx
schwientekdIT Director

Author

Commented:
That is a good article on ssrs but I am already comfortable creating the reports and including parameters in the report.  The part that I need help on is building a form in VS 2008 where you can input a parameter and click a submit button which would then generate the report.  Like in Access when you configure a click event to generate a report and a query has it's parameters linked to the form.
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008
Commented:
OK, would this be better?

Create Reports from Any Data Source Using SQL Server Reporting Services Custom Data Extensions
http://www.devx.com/dbzone/Article/31336/0/page/6

Or, are you talking about from a web site (ASP.NET)?
Private Sub RunRemote() 
    reportViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote 
    ' Get the Report Server endpoint from 
    ' the config file 
    reportViewer.ServerReport.ReportServerUrl = New Uri(txtReportServer.Text) 
    reportViewer.ServerReport.ReportPath = "/Prologika/TestDS" 
    ' Bind the dataset 
    SetParameters() 
    reportViewer.RefreshReport() 
End Sub 
 
Private Sub SetParameters() 
    Dim parameters As ReportParameter() = New ReportParameter(0) {} 
    Dim entitySalesOrder As New EntitySalesOrder() 
    sqlDataAdapter.Fill(entitySalesOrder) 
    parameters(0) = New ReportParameter("DataSource", entitySalesOrder.GetXml()) 
    reportViewer.ServerReport.SetParameters(parameters) 
End Sub 

Open in new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
schwientekdIT Director

Author

Commented:
This is close to what I am trying to find but unfortunately it is still a little over my head trying to interpret what to actually do with this code sample.  I think I am going to see if I can download some sample applications that work with the report viewer component in .net applications.  Thanks for your help!
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
Have you defined the parameters inside the report?  The code I showed you defines the parameters outside--in code.
schwientekdIT Director

Author

Commented:
Yes, I have defined the parameters in the report and it will run just fine when filling in the parameter toolbar fields and clicking View Report.  I want to be able to hide the parameter toolbar and create my own parameter fields to generate the report by clicking on a submit button.  Ideally I'd like to have a separate vb form which passes the parameters to the form with the report viewer on it but I would definitely settle for having the parameter fields on the same form as the report viewer control.
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
What type of project are you working with (Windows Forms, Business Intelligence Report Server, ...)?
schwientekdIT Director

Author

Commented:
I have both Visual Studio 2008 and 2005 installed on my machine.  I am creating a Windows Forms project using Visual Studio 2008.  For reporting I am using Visual Studio 2005/SQL 2005 Reporting Services, remote .rdl reports.  I use the Report Viewer control on a form in VS 2008 to link to the reports I have deployed with VS 2005.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.