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.

commented: No - this isn't free homework on demand -4

Please do not resurrect old/solved threads. If you want to ask question, start your own thread.


Have a look at forum rules.
Please read before posting - http://www.daniweb.com/forums/thread78223.html

Thread Closed.

commented: "adatapost the zombie thread slayer" - baggsie movie rights! +20
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.