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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC Connection to VFP Database and Crystal Report

Status
Not open for further replies.

KKZ

Programmer
Jun 27, 2001
25
0
0
US
Hi,

We have a client that runs our application from two different folders. Here is a sample how it is setup;

Folder1
MyApp.Exe
MyApp.Ini (pointing to a database in the folder DataFoder1)

Folder2
MyApp.Exe
MyApp.Ini (pointing to a database in the folder DataFoder2)

We have an ODBC connection to the database to run crystal reports (ver 8.5)

When MyApp runs and the user goes to reports section, we physically change the DSN file to point to the database based on our ini path setiing. We don't have any problem if you run application from one folder at a time. The problem comes when the app is running from both the folders. One would get wrong report as other user has already changed the database location.

Is there a way we can temporary change the location of the database in memory before running the report? Please help us and would appreciate if it is explaind with the code. Thanks,
 
We thought about this also. We could create unique DSN and assign to the application to use that DSN name. However, there is one thing that is not clear to us. When we create a report we assign a DSN to the report. How can we tell the report at run time that use another DSN instead of the one that was used upon creating the report? If this thing is clear, we can use your suggestion. Thanks anyway for responding.

 
KKZ,

Are you using the CR RDC? If so, you can try changing the Name and Location properties of each table that you are using. Set them both to the table name. These are properties of the report object.

Quick example:

loRep.databases.tables(1).name = "customer"
loRep.databases.tables(1).location = "customer"

Repeat with each table in turn.

Mike


Mike Lewis
Edinburgh, Scotland
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top