cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use C# to run same report on multiple MS SQL DBs?

Former Member
0 Kudos

up vote0down votefavorite

Hello SAP Community! I am a Systems Engineer for a software company and we are evaluating SAP Crystal Reports to see if it will suit our needs. I've downloaded a trial and am trying to create a test application to see if this will work but I'm a little stumped.

I'm using SAP Crystal Reports 2016 with the Visual Studio plugin, along with Visual Studio 2015.

What I've done is created a simple MDI application using C# in Visual Studio which contains multiple Crystal Reports Viewer forms which open an embedded report in a child window when the menu item is clicked. This application will sit on our development server and be used to run reports against client databases that get sent to us with problems.

Here's the issue: We've got multiple instances (and versions) of SQL Server running and we are getting multiple test databases daily which of course will be named differently. The reports are looking for one specific database only, because the report was created in CR looking for a specific ODBC connection via the Database Expert.

What I would like to do, is either on form load or via a button click, be able to have a box prompt the user for server and database name. For example:

SQLServer\SuperCoolInstance 
My_Cool_Database

The report would then connect to that database and display relevant information. I thought I should point out that all the SQL Server databases that this would run on would have identical schema but of course different data.

I want to be able to pass connection info from the application to the report instead of using the embedded datasource in the report.

Any idea on how I could accomplish this? Second best scenario would be to have something like an XML file that contains the server and database and the program looks at that when launching. Even though we'd have to edit the XML whenever we wanted to change datasources it would be something! I wouldn't know how to pursue that avenue either though.

Thanks very much in advance for any ideas or guidance.

Cheers.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Ethan,

You can get the data source info from the report, then using Windows API's create the DSN based on the info from the report and now the report should simply work, you will need to set the password.

Search for KBA 2281780 which points to a DOC file with a test app attached, it's for parameters but has code to set log on info. See if that helps you, it has code on getting the connection info from the report and subreports.

Don

Former Member
0 Kudos

Thank you for your response. I tried to have a look at the referenced KBA but get a message saying:

Your user does not have access to the SAP ONE Support Launchpad.

I really hope to be able to understand and resolve this issue to verify that SAP CR will suit our needs before we purchase it.


Thanks for any help you can provide.

Message was edited by: Ethan Rayhorn

0 Kudos

This doc link should work:

http://scn.sap.com/docs/DOC-70646

Don

Answers (0)