Board index » delphi » Crystal Reports Changing database on iSeries connection

Crystal Reports Changing database on iSeries connection


2006-03-18 01:36:06 AM
delphi104
I have a production library database called CBAPLIB, and test library
database called CBATLIB on my iSeries. I have a set of Crystal Reports that
generate reports from the production library database. I created an
application that updates the data and can generate these reports. The app
has the ability to switch between the production library database and the
test library database. I need to be able to switch the library database on
the Crystal Reports to pull the data from which ever library the application
is pointing at when a report is produced. The reports use an ODBC
connection to connect to the iSeries. I am using Delphi 7 and Crystal
Reports 10 VCL. Any help would be appreciated. Thanks in advance.
 
 

Re:Crystal Reports Changing database on iSeries connection

Hi Randy, in VCL, Delphi7 and Crystal 10, pretty sure this works:
Crpe1.ReportName := '.\' + filename.Text;
Crpe1.Connect.ServerName := <servername>;
Crpe1.Connect.DatabaseName := <db_name>;
Crpe1.Connect.UserID := <db_user>;
Crpe1.Connect.Password := <db_pwd>;
Crpe1.Connect.Propagate := True;
Thanks,
Doug
"Randy" <XXXX@XXXXX.COM>writes:
Quote
I have a production library database called CBAPLIB, and test library
database called CBATLIB on my iSeries. I have a set of Crystal Reports that
generate reports from the production library database. I created an
application that updates the data and can generate these reports. The app
has the ability to switch between the production library database and the
test library database. I need to be able to switch the library database on
the Crystal Reports to pull the data from which ever library the application
is pointing at when a report is produced. The reports use an ODBC
connection to connect to the iSeries. I am using Delphi 7 and Crystal
Reports 10 VCL. Any help would be appreciated. Thanks in advance.


 

Re:Crystal Reports Changing database on iSeries connection

I tried this and it didn't work. Here is my code.
Crpe1.ReportName := HoldReportName;
Crpe1.Connect.ServerName := 'cba';
Crpe1.Connect.DatabaseName := 'CBATLIB';
Crpe1.Connect.UserID := <my username>;
Crpe1.Connect.Password := <my passwordd>;
Crpe1.Connect.Propagate := True;
I need to change the library I connect to the database with at runtime
depending on if the user is using the test or production database.
CBA is an ODBC driver with CBAPLIB as the SQL Default library, and CBATLIB
is in the Library List.
"Doug" <XXXX@XXXXX.COM>writes
Quote

Hi Randy, in VCL, Delphi7 and Crystal 10, pretty sure this works:

Crpe1.ReportName := '.\' + filename.Text;
Crpe1.Connect.ServerName := <servername>;
Crpe1.Connect.DatabaseName := <db_name>;
Crpe1.Connect.UserID := <db_user>;
Crpe1.Connect.Password := <db_pwd>;
Crpe1.Connect.Propagate := True;

Thanks,
Doug

"Randy" <XXXX@XXXXX.COM>writes:
>I have a production library database called CBAPLIB, and test library
>database called CBATLIB on my iSeries. I have a set of Crystal Reports
>that
>generate reports from the production library database. I created an
>application that updates the data and can generate these reports. The app
>has the ability to switch between the production library database and the
>test library database. I need to be able to switch the library database
>on
>the Crystal Reports to pull the data from which ever library the
>application
>is pointing at when a report is produced. The reports use an ODBC
>connection to connect to the iSeries. I am using Delphi 7 and Crystal
>Reports 10 VCL. Any help would be appreciated. Thanks in advance.
>
>

 

Re:Crystal Reports Changing database on iSeries connection

Randy, the only difference is that I am (was) using ado instead of odbc. Not sure why that would make a difference. I did find though that if you are using odbc, you have the Crpe1.LogOnServer method at your disposal. This is supposed to do what you are trying to do (I think).
Good luck,
Doug
In other news, you may want to consider ADO instead of ODBC. It makes deploying your app easier since clients don't require and ODBC config.
"Randy" <XXXX@XXXXX.COM>writes:
Quote
I tried this and it didn't work. Here is my code.

Crpe1.ReportName := HoldReportName;
Crpe1.Connect.ServerName := 'cba';
Crpe1.Connect.DatabaseName := 'CBATLIB';
Crpe1.Connect.UserID := <my username>;
Crpe1.Connect.Password := <my passwordd>;
Crpe1.Connect.Propagate := True;

I need to change the library I connect to the database with at runtime
depending on if the user is using the test or production database.

CBA is an ODBC driver with CBAPLIB as the SQL Default library, and CBATLIB
is in the Library List.


"Doug" <XXXX@XXXXX.COM>writes
news:4420617f$XXXX@XXXXX.COM...
>
>Hi Randy, in VCL, Delphi7 and Crystal 10, pretty sure this works:
>
>Crpe1.ReportName := '.\' + filename.Text;
>Crpe1.Connect.ServerName := <servername>;
>Crpe1.Connect.DatabaseName := <db_name>;
>Crpe1.Connect.UserID := <db_user>;
>Crpe1.Connect.Password := <db_pwd>;
>Crpe1.Connect.Propagate := True;
>
>Thanks,
>Doug
>
>"Randy" <XXXX@XXXXX.COM>writes:
>>I have a production library database called CBAPLIB, and test library
>>database called CBATLIB on my iSeries. I have a set of Crystal Reports
>>that
>>generate reports from the production library database. I created an
>>application that updates the data and can generate these reports. The app
>>has the ability to switch between the production library database and the
>>test library database. I need to be able to switch the library database
>>on
>>the Crystal Reports to pull the data from which ever library the
>>application
>>is pointing at when a report is produced. The reports use an ODBC
>>connection to connect to the iSeries. I am using Delphi 7 and Crystal
>>Reports 10 VCL. Any help would be appreciated. Thanks in advance.
>>
>>
>