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!

Specifying the Database at runtime

Status
Not open for further replies.

PeteCozens

Programmer
Aug 30, 2001
12
NL
I've been asked to write a Crystal Viewer app since there doesn't appear to be one out there that fulfils the requirements I've been given, one of which it to allow the user to select which database to report against.

Does ANYONE have a clue how to do this???

I'm using the CRAXDRT.Report object (from CR 8.5) to store the report instance, and the CRViewer control to display it.

I've tried modifying the Location property of every Table in the Report's Database object (and then calling the database's Verify method), but I'm still suffering from the "Server has not yet been opened" error.

Answers on a postcard...

Thanks for any help,

Pete Cozens
 
You're not logging into the database. It doesn't have anything to do with Set Location inside the report.

Use .LogonServer or .SetLogonInfo.
 
Sorry - that's not it.

I'm calling the Crystal Application's LogonServer() method, and that part's working fine. If I connect to the same database as was used to develop the report, then the report is displayed correctly. It is just when I try to connect to a different database (with the same schema) that the error message is displayed.
 
Well, you're still not connecting to the database in some manner. That's what the error means.

If you do just a .LogonServer to Database1 and you have a subreport that has a table with a location of Database2.dbo.tablename, then you're going to have a problem. That's why Crystal recommends logging into the main report and every sub-report separately with .SetLogonInfo.

I usually take the easy way out and strip the name of the database off all of the tables in both the main report and subreport using Set Location.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top