Solved

Changing DataSource location for a Stored Procedure with CR XI

Posted on 2006-10-27
4
791 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

738 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