Solved

Changing DataSource location for a Stored Procedure with CR XI

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now