Skip to Content
avatar image
Former Member

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jun 02, 2009 at 01:16 PM

    Hello,

    The error suggests that you're having an issue logging onto the database.

    As a test you should be able to comment out your parameter code, database logon code, etc. Run the application and you should receive prompts for any missing information - like logon credentials or parameters.

    If this works, then start adding back code until the application breaks again. Then you can concentrate on that area of the code.

    Also - before starting, make sure you're running a report that does not have Saved Data. Open the report in Crystal Reports. Go to the File menu. Is there a check mark next to Save Data with Report? If so, clear it and resave the report. If not, you should be all set for the test.

    Sincerely,

    Dan Kelleher

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hello,

      I added the call to Export() and the options at the end of your code and it works.

      Looking carefully at the differences between your code and my code, probably the problem is solved by using - as you do - a separate variable crConnectionInfo to set all tables ConnectionInfo instead of assigning the existing connectioninfo.

      In short it works !

      Thank you so much for your help. I granted you 10 points.

      Regards,

      --

      Francois PIETTE

      http://www.overbyte.be