Skip to Content

Set CR Data Source in Application causes it to stop working

I have a VS 2013 application that displays a CR report in a viewer. It works fine if I use the data source as created, but, if I try to set the data source at runtime, I get an error. "UploadSales has stopped working. Windows is searching for a solution." I have tried creating a 64 bit ODBC as well as a 32 bit ODBC. I still get the error. Any ideas?

Here is my code:

ReportDocument reportDoc = new ReportDocument();




Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Nov 17, 2015 at 05:43 PM

    Hi Anita,

    SetDataSource only allows you to pass a Recordset to the report, not change the ODBC datasource.

    Your application should be setting the LogonInfo property in the Table method. You'll have to loop through each table in the report and populate LogonInfo, you would pass the datasource, database name, username and password.

    Call ApplyLogonInfo after each table to apply the new logon for the table.

    That will get your reports to use the new ODBC datasource. Have a search for LogonInfo in the for samples. I know I've posted about this before with C# and PowerShell code.

    Good luck,


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 17, 2015 at 05:36 PM

    Hi ANita

    Make sure you are using the following in your config file:

    <startup useLegacyV2RuntimeActivationPolicy="true">

    <supportedRuntime version="v4.0"/>


    See KBA 1525432 - Could not load file or assembly 'file:///<Path>crdb_adoplus.dll' or one of its dependencies

    Also see the following:

    Crystal Reports Guide To ADO.NET


    Crystal Reports for Visual Studio .NET - Walkthrough - Reporting Off ADO.NET Datasets

    As a reference use:

    SAP Crystal Reports .NET SDK Developer Guide

    SAP Crystal Reports .NET API Guide

    - Ludek

    Senior Support Engineer AGS Product Support, Global Support Center Canada

    Follow me on Twitter

    Got Enhancement ideas? Use the SAP Idea Place

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 02, 2015 at 04:58 PM

    Okay I am having the same problem. I am trying to display a CR Report in a CR Viewer from a visual studio application. When I first tried it from the development machine, I got an error "Could not load file or assembly 'file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI". I realized I had not changed the .config file to include the "UseLegacyRuntime"... I added that and it ran fine. Now when I try to run the program from the server I am getting the same error there. When I look at the "dotnet" subfolder on the server, there is only one .dll CrystalDecisions.Data.AdoDOTNetInterop.dll while my development machine has MANY .dlls in this folder. Is this the problem? If so, how do I resolve it? Thank you in advance.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.