Solved

Changing DataSource location for a Stored Procedure with CR XI

Posted on 2006-10-27
4
787 Views
Last Modified: 2012-06-21
Hi,

I have reports (created with Crytal Report XI) using Stored Procedure. If I'm looking at the SQL query done by the report, I see that the database name is "hardcoded" in the string.  These reports will be ran using a C# application and the datasource is overriden to connect to the database/server used by the application.

However, when doing some testing, I noticed that the data displayed in the report does not match with the data displayed in the application. The connection of the report does not seem to have changed when I gave the new connection (using C#).  I did some test and I have no problem when the report was builded using a "command" instead of the stored procedure directly from the list.

It's where I'm completely lost, what should I do next? I can easily change the DataSource location of my report to point to another database, but in the production environment, I'll be using two different database server so I'll have to change the reports twice before they can be used by our customer.  My second option was to change the DataSource for a "Command", but since the fields are linked to an adapter, if I add a new adapter (Querying the same stored procedure with the same parameters / fields) and remove the old one, the fields will be deleted from the report!

Our development environment is Visual Studio 2003 (using C# as stated), SQL Server 2000 and Crystal Report XI. In summary, I need a quick and easy (if possible) way to change my reports to reflect the connection specified by our application.

Thanks for your time.
0
Comment
Question by:TelDig
  • 3
4 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 17819149
Is the report saved with data?  CHeck under the FILE menu or in OPTIONS

mlmcc
0
 

Author Comment

by:TelDig
ID: 17819831
Hi,

some of them were flagged with the save data. I tested it and it doesn't seem to change the database used.  If I use the CR designer and change the datasource location, it will work fine; but as I have stated, I will use many databases when I'll be in production.

Curiously, we did some changes in our applicaiton and we made the report worked.

We were using the command :
            reportDocument.DataSourceConnections[0].SetConnection(databaseServer, databaseName, true);
to set the new connection and with my stored procedures it didn't work.

Now I browse through all the tables (it should be only my stored procedure) and I change the table location with the database name that I use. Unfortunately, we used that method in the past and it brings other problems; BusinessObjects told us to not use that method. I will do some more testing about that one.

And thanks for the quick answer and the "OPTIONS" hints. I'm guessing since I unchecked it there, it won't be checked by default ?
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 17820470
As far as I know once changed in options it applies to all new reports.

To test it
Open Crystal (no report)
Click FILE --> OPTIONS
Verify it is not checked.  If it is uncheck it.
Close Crystal to save the changes.

I don't know why Crystal has SAVE DATA set as the default.

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 17823076
Glad i could help

mlmcc
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question