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?
schwientekdIT DirectorAsked:
Who is Participating?
 
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
 
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
 
schwientekdIT DirectorAuthor 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
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
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
 
schwientekdIT DirectorAuthor 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
 
schwientekdIT DirectorAuthor 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
 
schwientekdIT DirectorAuthor 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
 
schwientekdIT DirectorAuthor 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.