Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change my datasource at runtime

Status
Not open for further replies.

MMock

Programmer
Aug 23, 2007
17
US
I've been developing my reports on my machine and with a database on a local server. So in each ofmy rpt files, I set the datasource location to that db and server. Now I want to deploy at my customer's. Instead of changing each report file, I'd like to put the database and server names in the code. Can anyone tell me how this can be accomplished?
 
Because I didn't know how to do this in code, I decided to just change each rpt file to point to the other database. I have four reports. The first one I did worked, the remaining three got this error:

Some tables could not be replaced, as no match was found in the new data source. Please specify the table required for any unmodified tables.

I have a VPN connection to the new datasource. I copied my stored procedures there. I try to Update my current source to the new one, which I was able to successfully add as a datasource to the first report, then it seemed there for the other three. I don't know what Crystal means by no match was found.

There are hadly any hits on this message on the Internet. Has anyone experienced it? Does anyone know what this might be? If not, is there an alternative way I can do this, aside from doing the report from scratch again (which I'm almost desparate enough to do).

Thanks.
 
Did you try to verify data in the just changed report? You have to be sure that your definitions same as your procedures and functions are located in the same place and have no naming differences. If a procedure is calling another procedure or function those needs to be created as well in your server.

In order to dynamically change the location of your report you have to use classes in the visual application you are developing where you can talk to crystal through API calls. It needs a little programming anyway.

Diego
 
Thank you Diego.

Both databases should have been exactly the same. But what I discovered is that my development database had gotten a bit ahead of the database at my client's site, and my client did not have a table referenced by one of my stored procs which the report uses. This error was not obvious. When I tried to Update to the new database, I got a Map Fields dialog, which someday I'll understand maybe but currently it's my biggest fear. I'll submit my Update and pray, please don't ask me to map fields. Anyway, I found my error only by running the stored procedure on the client's server and having SQL Server tell me there was no such table. I created the table and all is well.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top