Solved

Changing DataSource location for a Stored Procedure with CR XI

Posted on 2006-10-27
4
789 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
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 …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

762 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