Question

Can't change report's Initial Catalog in VB6

Rating7.8Very Good

I have am using Crystal Reports XI with VB6.  The program needs to switch databases and servers at run time, using ADO.  This works with CR6 reports and ODBC.  I run the code, and the server changes but the database (Initial Catalog) does not.  Even if I keep the same server, the databse does not seem to change.  Attached is a snippet of my code where the databse change is made ... perhaps theres a better way?  
The variable gsInitCatalog gets set to the name of the Database, depending what the user selects: "DBProd" or "DBTest".
The report is "attached" to a single Stored Procedure, not a table.  The stored procedure is the same in both databases.  Parameters are passed to the report through the VB6 code.  The report was created by referencing the stored procedure in "DBProd", so running the report in VB6 against that databse works fine.  Data is not stored with the report.

Also, I am hearing that this may also be a (big) bug in CRXI ... ?

Set crApp = New CRAXDRT.Application
Set crRpt = crApp.OpenReport(lsPath, 1)
crApp.SetLicenseKeycode ("XXXXX-XXXXXXX-XXXXXXX-XXXX")
Set dbProperties = crRpt.Database.Tables.Item(1).ConnectionProperties
    dbProperties("Data Source") = gsSQLServ  '--WinServer1\SQLSERVER2008
    dbProperties("Initial Catalog") = gsInitCatalog  '-- DBProd
    dbProperties("User ID") = "user1"
    dbProperties("Password") = "password1"
                              
1:
2:
3:
4:
5:
6:
7:
8:

Select allOpen in new window

See More

Solution

Access this solution immediately by signing up as a member of CrystalReportsExperts.com--it’s quick, easy, and secure. We will return you to this solution, unlocked, when you’re done.

About this Solution

Sign up Now to View This Solution
Zone
general
Tags
database ADO VB6
Participating Experts
1
Solution Grade
A

Replies

 
by: mlmcc

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: RobRud

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: RobRud

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: RobRud

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by:

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Log In

Forgot your password?Sign up

Stay Connected

Top Experts

  1. mlmcc

    356,274

    Wizard

    0 points yesterday

    Profile
  2. James0628

    80,896

    Master

    0 points yesterday

    Profile
  3. LinInDenver

    4,800

    0 points yesterday

    Profile
  4. peter57r

    4,000

    0 points yesterday

    Profile
  5. 13598

    3,520

    0 points yesterday

    Profile
  6. PCIIain

    1,700

    0 points yesterday

    Profile
  7. RickIsWright

    400

    0 points yesterday

    Profile
  8. Dan3D

    300

    0 points yesterday

    Profile

BrowseAre you an Expert?