• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1129
  • Last Modified:

Pass VB form parameters to ssrs report

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?
0
schwientekd
Asked:
schwientekd
  • 5
  • 5
1 Solution
 
Bob LearnedCommented:
Are you talking about .rdl files, or .rdlc files?  Local reports or server reports?  How are you defining and using the reports?
0
 
schwientekdAuthor 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.
0
 
Bob LearnedCommented:
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
0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
schwientekdAuthor 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.
0
 
Bob LearnedCommented:
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

0
 
schwientekdAuthor 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!
0
 
Bob LearnedCommented:
Have you defined the parameters inside the report?  The code I showed you defines the parameters outside--in code.
0
 
schwientekdAuthor 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.
0
 
Bob LearnedCommented:
What type of project are you working with (Windows Forms, Business Intelligence Report Server, ...)?
0
 
schwientekdAuthor 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.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now