While working with Crystal Reports for Visual Studio 2010, I came across a strange problem. The problem was that the report was prompting me through a dialog box to input values for the parameters defined in the report when I was showing the report in my application. It was indeed a strange behavior as I had assigned the values to all the parameters in the report before showing the ReportViewer control.
I then started searching the internet for the solution to this problem, and came to know that users are experiencing this problem from as early as 2005!!! This made me wonder why this problem has not been resolved yet as I am using the very latest version (CR for VS 2010 Update 4) downloaded few days before from the SAP website. I came across many solutions that had been suggested to get rid of the dialog box. I tried most of them but unsuccessfully as the obdurate dialog box refused to let go, and this made me really frustrated.
After spending many hours trying to find a fix to this issue, I finally got the solution posted in this blog post. The solution is to follow the steps provided below when showing a report:
I then started searching the internet for the solution to this problem, and came to know that users are experiencing this problem from as early as 2005!!! This made me wonder why this problem has not been resolved yet as I am using the very latest version (CR for VS 2010 Update 4) downloaded few days before from the SAP website. I came across many solutions that had been suggested to get rid of the dialog box. I tried most of them but unsuccessfully as the obdurate dialog box refused to let go, and this made me really frustrated.
After spending many hours trying to find a fix to this issue, I finally got the solution posted in this blog post. The solution is to follow the steps provided below when showing a report:
- Assign a data source to the report like
repotDocumentObject.SetDataSource(aDataSourceObject)
- Assign the report to the CrystalReportViewer control like
reportViewer.ReportSource = reportDocumentObject
. - Set parameter values like
reportDocumentObject.SetParameterValue(0, invoiceDate)
.
Thanks that really helped me
ReplyDeleteI just moved the SetParameterValue after the reportViewer.ReportSource statement, then it worked. Datasource setting is irrelevant to me. Thank you very much. You saved my day
ReplyDeleteMan, you saved my life. As simple as that, and wouldn't ever imagine. Thank you!
DeleteIt is super blog, I would like to be like you. Please Visit:
ReplyDeletecafe pos
retail system
pos cash register
Hi, I tried to follow your instruction however the parameter prompt still showing up. Please my code below.
ReplyDeletePrivate Sub CRViewReport()
Dim strCRReportName = "CheckOut.rpt"
Dim rpt As New ReportDocument
rpt.Load(Application.StartupPath & "\Reports\" & strCRReportName)
frmcrv.CrystalReportViewer1.ReportSource = rpt
rpt.SetParameterValue("ParamCheckID", 15)
frmcrv.Show()
End Sub
By the way, I use command query in the Crystal report. All i need is to pass a parameter to crystal report.
Thanks in advance.
Thanks alot ...
ReplyDeletekars
ReplyDeletesilivri
yalova
bilecik
bitlis
ULW