Hello!
I did the sending of data to the parameter of the SQL procedure worse than telerik reporting, it always returns the results that I initially put when I added the parameters to the report. I need to be able to replace those values that I set by default with the ones that I send to obtain different results.
From already thank you very much, greetings
Dim instanceReportSource = New Telerik.Reporting.InstanceReportSource()
Dim codProddesde = frmSeleccionStockMinimo.lblProdDesde.Text
Dim codProdhasta = frmSeleccionStockMinimo.lblProdHasta.Text
Dim cantidad = frmSeleccionStockMinimo.txtcantidadMinima.Text
instanceReportSource.ReportDocument = New telReportStockMinimo
Me.ReportViewer1.ReportSource = instanceReportSource
instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("codProdDesde", codProddesde))
instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("codProdhasta", codProdhasta))
instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("cantidad", cantidad))
ReportViewer1.RefreshReport()
I did the sending of data to the parameter of the SQL procedure worse than telerik reporting, it always returns the results that I initially put when I added the parameters to the report. I need to be able to replace those values that I set by default with the ones that I send to obtain different results.
From already thank you very much, greetings
Dim telReportStockMinimo As New Telerik.Reporting.Report
Dim instanceReportSource = New Telerik.Reporting.InstanceReportSource()
Dim codProddesde = frmSeleccionStockMinimo.lblProdDesde.Text
Dim codProdhasta = frmSeleccionStockMinimo.lblProdHasta.Text
Dim cantidad = frmSeleccionStockMinimo.txtcantidadMinima.Text
instanceReportSource.ReportDocument = New telReportStockMinimo
Me.ReportViewer1.ReportSource = instanceReportSource
instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("codProdDesde", codProddesde))
instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("codProdhasta", codProdhasta))
instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("cantidad", cantidad))
ReportViewer1.RefreshReport()
Please test updating the instanceReportSource's Parameters before setting it as a ReportSource for the ReportViewer1 object:
Dim telReportStockMinimo As New Telerik.Reporting.Report Dim instanceReportSource = New Telerik.Reporting.InstanceReportSource() Dim codProddesde = frmSeleccionStockMinimo.lblProdDesde.Text Dim codProdhasta = frmSeleccionStockMinimo.lblProdHasta.Text Dim cantidad = frmSeleccionStockMinimo.txtcantidadMinima.Text instanceReportSource.ReportDocument = New telReportStockMinimo instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("codProdDesde", codProddesde)) instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("codProdhasta", codProdhasta)) instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("cantidad", cantidad)) Me.ReportViewer1.ReportSource = instanceReportSource ReportViewer1.RefreshReport()
Hello, thanks for answering, I still have the same problem, I leave the report with the parameters that I manually assign to the report in the design
My apologies Agustin, I had misunderstood the problem. You may provide new parameter values to viewer through the ReportViewer.ReportSource.Parameters collection, for example:
Me.ReportViewer1.ReportSource = instanceReportSource Me.ReportViewer1.ReportSource.Parameters.Add("cantidad", cantidad)
If you use the report parameters with a SqlDataSource, I recommend having a look at the Using Parameters with the SqlDataSource component article. Make sure that you are correctly using the parameters with the query and that you use the report parameters' values at runtime instead of the constant values - Using Report Parameters programmatically.
Check if you can pass parameters through our VB.WinForms demo project. This project can be found in the installation directory of Telerik Reporting > Examples > VB. Test the following code with the MainForm_Load event:
Dim typeReportSource As New Telerik.Reporting.TypeReportSource() typeReportSource.TypeName = GetType(Invoice).AssemblyQualifiedName Me.reportViewer1.ReportSource = typeReportSource Me.reportViewer1.ReportSource.Parameters.Add("OrderNumber", "SO51089") Me.reportViewer1.RefreshReport()
This should load the Invoice report with the report parameter value of SO51089(you should be able to see it when viewing the report.)
If you are passing the report parameters as I have showcased here and in my last reply, the report parameter values should be getting updated and if that is not reflected in the returned data, there is probably something wrong with the SqlDataSource parameters. For that reason, I would like to request you to attach the report definition files, or the whole project, to this thread and I will have a look at them.
You may also record a trace listener while running the WinForms application(your WinForms app) to see if there are any runtime errors - How to: Create and Initialize Trace Listeners.
For an example of a correct setup of using report parameters to set values of SqlDataSource parameters, please have a look at our Dashboard report. It is inside the VB.ReportLibrary project.
here I leave a step by step of what I was doing in images.

First I assign the procedure I want to use
secondly, the parameters I need are automatically assigned to me
third, I assign the parameters in the report
fourth, I open a form and put a reportviewer on it
finally, in the load of this form I apply the code
Thank you for the provided screenshots!
If you have done things exactly as you have shown in the images, then I think that the problem is in image 2, the Configure data source parameters step. In this step, in the Value Combobox, you must select the appropriate report parameter for each SQL query parameter. To demonstrate how the SQL parameters should be set up, I have recorded a short video of this process and have attached it to my comment. While in the video I use the Standalone Designer, the same steps can also be done in the VS designer and they will look exactly the same.
Check out the video and let me know if you need further assistance.