Results 1 to 3 of 3

Thread: Changing database at runtime yields same data

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    3

    Changing database at runtime yields same data

    Hi, I am using VB6 (code below), CR11, MSSQL 2000. When I change the database, data is still pointing to the 1st db and Save Data with Report is not checked. No subreport.

    With crReport.Database
    For i = 1 To .Tables.Count
    .Tables(i).SetLogOnInfo g_Server, g_Database, g_User, g_Pwd
    Next
    End With

    In CR11, if I open the report, do Verify Database and change the db there, it also doesn't work because data is still pointing to the old db. When I look at the properties in Set Database Location, the connection properties show Initial Catalog pointing at the new db but the table's properties show that the Catalog still pointing to the old db.

    Please help. Thanks.

  2. #2
    New Member
    Join Date
    Sep 2006
    Posts
    3

    Re: Changing database at runtime yields same data

    I have exactly the same problem...

  3. #3
    New Member
    Join Date
    Sep 2006
    Posts
    3

    Re: Changing database at runtime yields same data

    Here is the answer !!!

    Dim crxapplication As CRAXDRT.Application
    Dim crxsubreport As CRAXDRT.Report
    Dim crxDatabaseTable As CRAXDRT.DatabaseTable


    Set crxapplication = CreateObject("crystalruntime.application.11")
    Set crxreport = crxapplication.OpenReport(PathReports)

    For Each crxDatabaseTable In crxreport.Database.Tables
    crxDatabaseTable.ConnectionProperties("Initial Catalog") = g_Database
    crxDatabaseTable.ConnectionProperties("Data Source") = g_Server
    crxDatabaseTable.ConnectionProperties("Integrated Security") = True
    crxDatabaseTable.Location = crxDatabaseTable.Location

    Next crxDatabaseTable

    Thanx to Experts Exchange

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width