Skip to Content

crystal report viewer component

I have a desktop application that uses the crystal report component to render reports programmatically through a ODBC connection to Oracle and SQL Server databases.

I code in C# with Visual Studio 2013 and I have all of the service packs installed up through 20.

We have reports developed in crystal 13 that use ODBC connectivity. I want to programmatically change the type of database connection from ODBC to use a direct Oracle or SQL Server connection without going through all of my reports and changing them.

When I looked at the RASProgramming.pdf file I can't tell if what I want to do is supported.

I would like to know if I can realistically do this before I submit code showing my attempt to come up with a solution. I have seen links on your site for dynamically changing a connection but they do not translate well since they are all web based solutions and they are in Visual Basic. Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jul 12, 2017 at 02:27 PM

    Hi Ben,

    On the download page I have an app that can do ReplaceConnection(), it's in the parameter test app:

    https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

    And this link:

    https://blogs.sap.com/2016/02/17/how-to-parameters-in-crystal-reports-for-visual-studio-net/

    Have a look at the ReplaceConnection() routine, you will need to alter it.

    CR supports a Native Oracle Driver but we no longer have one for SQL Server, it only supports ODBC or OLE DB.

    I suggest you stick with ODBC, MS is dropping OLE DB because they are saying ODBC is the new Standard that is easier to maintain across all platforms.

    Oracle has problems with their OLE DB provider so better to stay on ODBC also. But CR's Native Oracle will work.

    Also, the SQL generated is quite different between MS SQL and Oracle, at times, depending on the complexity, it is better to maintain 2 versions. Field Type Mapping is a pain with unique types and CR for VS does not have a Mapping API, if it can't map the field it simply deletes the field causing problems of course.

    One option is to use a Command connection, there you have the ability to replace the complete SQL, be careful with the fields again, use Alias's if possible. There is no way to may a report based on tables to a Command so it would require you to copy the SQL from the Table based Report and paste it into the Command of a new report and then copy/paste all objects.

    Don

    Add comment
    10|10000 characters needed characters exceeded

    • When I run the Unmanaged_RAS10_CSharp_Parameters.exe, Load my report and set my the server, database, username and password I get the message

      Must be logged on before SQL can be retrieved

      GetConcurrentUsage: 0

      RPT Data Source Info:

      Table Name: P_OPF_RPT_MEMBER_HISTORY

      Server Name: N/A (I have hidden the actual name)

      User ID: N/A (I have hidden the actual username)

      Password: (I have hidden the actual username)

      No data source or failed to log on.

      What does this mean? I am attempting to attach to an oracle server. thanks

  • Jul 13, 2017 at 04:28 PM

    Run in debug mode and look what is happening in the work flow and comment/uncomment out any code that is not required or is..

    If the data source needs a parameter then fill that in also.

    Start from a simple report first and then once that works start adding more parts.

    Don

    Add comment
    10|10000 characters needed characters exceeded