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

How can I Set

Status
Not open for further replies.

Bodrum81

Programmer
Nov 5, 2003
29
DE
new Information in a Report.

for example in the report are saved these data
User: bodrum
database: ""
server: test
passw: ""

but I want to change these data @ RUNTIME with a method.
how can I realize that.
for example the new data for the report.
User: me
database: ""
server: pro
passw: ""

i think the call have to looks like
m_Report = m_Report.SetData(user, server, database, passw);

has anybody an idea??
 
that makes my report emty

but i only want to change the logoninformation from the report which are saved when I create the Report @ first time.
 
You don't mention the version of Crystal you are using or the development environment. Check out the sample applicatons from Crystal at the link below. Most are VB examples but there is a sample for Visual C++ as well. What you are looking for is the SetLogonInfo method. Look at the samples under Database Issues in the pdf below:

 
Hi FVTrainer

yes thats right. SetLogonInfo is the method which can solve my problem.
But now is the problem when I want to close the Report and the Database-Connection, that Crystals-(runtime) give me an error-message! "unable to log off" cause any report still use this server.
?

for example.
my reports data: user: me pass: xxx database: "" server: test
and in the logondialog i give user: me pass: xxx databse: "" and server: example

AND I not use SetLogonInfo
I use LogOnServer
and afterthen I call report.ViewReport();
I get the error message. server has not been opened. (that comes cause the connection-Data from the report is not the same connection-Data from the logonDialog).
BUT when i look in the instance manager from oracle I see that this programm has a connect to my server.
and then I choose the menu-point Report --> Close
the Connection will be close!

I think Crystal do internal things @ SetLogonInfo


 
Ok, I'm a bit confused because you say that you do not use SetLogonInfo, and then later you say "I think Crystal do internal things @ SetLogonInfo." First, SetLogonInfo and LogOnServer are mutually exclusive approaches. Do one or the other. LogOnServer works if all the tables on the report are in the same Database. Since you've identified your database as Oracle, I would ask is this true? Are all the tables in the report in the same database (if you look in Database | Set Location in Crystal Reports, you will see each table described as database.owner.tablename. Are they all the same database?)?

If all the tables are in the same database, then LogonServer should work. But I'm not sure you're passing the correct arguments for the LogonServer method. The arguments are dll_name, server_name, database, user id, and password, as in:

LogOnServer "pdssql.dll", "dell-laptop", "Northwind", "green", "password"

In your case, the dll would be the oracle driver.

If your report uses tables in multiple databases, you would not use the LogOnServer method. Instead, you would use the SetLogonInfo method of the table object.

Anyway, if you are successfully using the LogOnServer object, before closing your report, try using the LogOffServer method. It takes the same arguments as the LogonServer method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top