Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ReportDocument.SetParameterValue problem

Hello !

I need some advice for this problem:

I have a very simple CR2008 report used from my program (C#, VS2008, SQL2005, Northwind demo database). The report is used to generate a PDF document using Export method of ReportDocument object. It works OK.

Now I added a discrete parameter (a country) in the report to filter the result. In Crystal Report designer I can change the parameter value and see the report (preview) filtered according to the parameter. Now I need to set the parameter in my program at runtime before calling Export().

Calling

reportDoc.SetParameterValue("Country", "USA");

I get an exception at runtime which is totally unrelated to the parameter: "Code from database provider: 17. Unable to start connexion" (Translated from french so the exact english text may be a little bit different). Without that code line, the program is working OK and report is filtered with country selected in report designer.

Any help is appreciated.

Regards,

--

Francois PIETTE

http://www.overbyte.be

Former Member
Former Member replied

Hello Francios,

What I asked you to do was a test. As you know, it is often helpful to start at the beginning and work your way up.

I used your code and put it into my simple application. I commented out the things that are not needed on my end - like the Try/Catch, and the test for the database name.

Your code works fine for me in my simple windows application. You should test this yourself if you haven't done so already. If this works then it may be somehow related to how you are using it in the COM object.

Sincerely,

Dan Kelleher

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question