We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,539 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

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"))

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

3
Contributors
3
Replies
8 Months
Discussion Span
3 Years Ago
Last Updated
5
Views
Question
Answered
Kids
Newbie Poster
7 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Self-Answered as of 3 Years Ago

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!!!

Kids
Newbie Poster
7 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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.

newVB
Newbie Poster
1 post since Apr 2010
Reputation Points: 6
Solved Threads: 0
Skill Endorsements: 0

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.

__avd
Posting Genius (adatapost)
Moderator
8,736 posts since Oct 2008
Reputation Points: 2,141
Solved Threads: 1,262
Skill Endorsements: 50

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.2864 seconds using 2.66MB