I have one problem when passing value to parameters for Crystal Report Viewer. The parameters are from Stored Procedure which I have defined.

My aim is to accept values from user and display it accordingly. I try to write code as below in Button View Click Event:

Dim rptdoc As New ReportDocument rptdoc.Load(Application.StartupPath & "\Reports\SummaryAdsRecordBetweenDate.rpt") '@startdate is parameter in stored procedure rptdoc.SetParameterValue("@startdate", CDate("2009/08/01")) '@enddate is parameter in stored procedure rptdoc.SetParameterValue("@enddate", CDate("2009/08/13"))

rptViewer.ReportSource = rptdoc rptViewer.RefreshReport() [\code]

But the problem is that Crystal Report Viewer does not accept my passed values and prompt me to input values for @startdate and @enddate in its dialog box.

If you have faced the same problem or have any solution, I will be grateful for your help...

Thank you very much! Kids[code=language]
Dim rptdoc As New ReportDocument
rptdoc.Load(Application.StartupPath & "\Reports\SummaryAdsRecordBetweenDate.rpt")
'@startdate is parameter in stored procedure
rptdoc.SetParameterValue("@startdate", CDate("2009/08/01"))
'@enddate is parameter in stored procedure
rptdoc.SetParameterValue("@enddate", CDate("2009/08/13"))

rptViewer.ReportSource = rptdoc
rptViewer.RefreshReport()
[\code]

But the problem is that Crystal Report Viewer does not accept my passed values and prompt me to input values for @startdate and @enddate in its dialog box.

If you have faced the same problem or have any solution, I will be grateful for your help...

Thank you very much! Kids

Now I found the solution!!!
Only one small thing to edit in my code above....

Dim rptdoc As New ReportDocument
rptdoc.Load(Application.StartupPath & "\Reports\SummaryAdsRecordBetweenDate.rpt")
'@startdate is parameter in stored procedure
rptdoc.SetParameterValue("@startdate", CDate("2009/08/01"))
'@enddate is parameter in stored procedure
rptdoc.SetParameterValue("@enddate", CDate("2009/08/13"))

rptViewer.ReportSource = rptdoc

'rptViewer.RefreshReport() : change this line to 
rptViewer.Refresh()

I just try changing and see the result. Then it does work.....

Hope you don't laugh at this problem.....

Thank you!!!

Hi Kids,

I am doing the same thing as you had done here but I am still getting error. Can you post your .aspx and vb files here?

Hope to hear from you.

Thanks a lot.

Comments
No - this isn't free homework on demand
This question has already been answered. Start a new discussion instead.