Skip to Content
0

crystal report viewer component

Jul 12, 2017 at 12:28 PM

62

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Don Williams
Jul 12, 2017 at 02:27 PM
0

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

Show 5 Share
10 |10000 characters needed characters left characters exceeded

Hi Don, thank you for the information. Let me take a look at what you provided me and I will get back to you. I appreciate your help

0

Hi, I am getting

We are sorry, but the site you are looking for is temporarily out of service. Please try again later!

on the Downloads Page

0

Hi Don, I looked on the web page Test app link and I could not find the ReplaceConnection() method. Am I looking in the wrong place? It also looks like each report is it's own user interface. I wrote an application back in 2008 that takes a selected report (any one of the 160 total) and generates a parameter input screen (the users did not like default behavior of the one from Crystal) that contained on the fly generated text boxes, comboboxes, datetimepickers based on the report structure. I implemented this screen using polymorphism and it has been working fine since 2008. where my program looks at how the input parameters are specified in the report and crystal reports and generates a that we have report, irregardless of it's p

0

Ok I finally found the application and I am taking a look at it.

0

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

0
Don Williams
Jul 13, 2017 at 04:28 PM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Don, Thanks for the reply. I take your advise and look at it again.

0