Can I show Parameter results in Report

Hi,

I have a problem to showing parameter values in my report for exampel (From Date and To Date).

I define public property in my code but i am not able to show these values in my report.

Public Class StatisticsForm
Public fromDate As DateTime
Public tilDate As DateTimePrivate Sub StatisticsForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

fromDate = Now()
tilDate = Now()
Me.Sp_CreateStatisticsTableAdapter.Fill(Me.PromusDataSet1.sp_CreateStatistics, fromDate, tilDate)

Me.ReportViewer1.RefreshReport()

End Sub

How can I show fromDate and EndDate in my report



Answer this question

Can I show Parameter results in Report

  • veneto

    I've just been through this...  The parameters you have are probably for the query only and have not been set up in the report (Report->Report Parameters).  Set up the report parameters and then work from the following:


    Dim p1 As New Microsoft.Reporting.WinForms.ReportParameter("fromDate", fromDate.toString)
    Dim p2 As New Microsoft.Reporting.WinForms.ReportParameter("tilDate",tilDate.toString)
    Dim parms(1) As Microsoft.Reporting.WinForms.ReportParameter
    parms.SetValue(p1, 0)
    parms.SetValue(p2,1)
    Me.ReportViewer1.LocalReport.SetParameters(parms)
    Me.ReportViewer1.RefreshReport()

     


    Good luck!
    DaveL

  • ldc555

    Did you ever solve this   I am having the same problem.

    Thanks,

    Paula

  • PaulTheSoftwareDeveloper

    I have set the code as above and setup in the report(Report->Report Parameter), FromDate and TilDate, But now error come like this "An attempt was made to set a report parameter 'fromDate' that is not defined in this report".

    Where I am wrong Please Help!

  • Can I show Parameter results in Report