Help: Using Parameter Stored Procedure in Crystal Report
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"))
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"))
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
3
Contributors
3
Replies
8 Months
Discussion Span
3 Years Ago
Last Updated
5
Views
Question Answered
Related Article:how to create crystal report using xml files?
is a VB.NET discussion thread by y2kshane that has 3 replies, was last updated 2 years ago and has been tagged with the keywords: crystal, report, vb.net, xml.
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.....