Results 1 to 7 of 7

Thread: Dynamic Database Linking - CR XI

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2005
    Posts
    15

    Dynamic Database Linking - CR XI

    Hi bros..

    I am using CR XI. I designed a report and added test SQL Server 2000 database to view and test the report results. Now in my program, I have to connect to the database using a dynamic connection string.

    e.g in deign I am using testdatabase. Once design is done, I have to conenct to the ProductionDatabase in my VB code.

    Thanks for your urgent reply

  2. #2
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: Dynamic Database Linking - CR XI

    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2005
    Posts
    15

    Re: Dynamic Database Linking - CR XI

    Sorry but its for Crystal 9. I need for XI.

    I know I have to use Creport.LogOnServer method but its not working. It does not give me any error but displays the data of design time database.

    Since all the tables and links are desinged, I don't want to delete all and redesign in my code. It sounds stupid.

    I should be able to just logon to the desired server and thats it.

    Right?

  4. #4
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: Dynamic Database Linking - CR XI

    Quote Originally Posted by tansarbh
    I know I have to use Creport.LogOnServer method but its not working. It does not give me any error but displays the data of design time database.
    Check that you're not saving data with the report. When designing a report, by default it saves the data with the report, which means that everytime you run the report you get the same original data.
    Open your report in Crystal and have a look under the File menu and make sure that Save Data with Report is not checked.
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2005
    Posts
    15

    Re: Dynamic Database Linking - CR XI

    Quote Originally Posted by pnish
    Check that you're not saving data with the report. When designing a report, by default it saves the data with the report, which means that everytime you run the report you get the same original data.
    Open your report in Crystal and have a look under the File menu and make sure that Save Data with Report is not checked.
    Yeah, I am aware of that and its not checked. Right now, the only solution is to create two ODBC connections and change it every time I have to switch the databse....which sounds non professional....

    Thanks.

  6. #6
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Dynamic Database Linking - CR XI

    I would try the solution posted in the other tread anyway (even if it is for version 9). I don't think they have changed the connection properties from 9 to 11.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  7. #7
    New Member
    Join Date
    Jul 2006
    Posts
    3

    Re: Dynamic Database Linking - CR XI

    Hi, I am having the same problem. VB6, CR11, SQL 2000. When I change the database, data is still pointing to the 1st db and Save Data with Report is not checked.

    Dim crCrystal As New craxdrt.Application
    Dim crReport As craxdrt.Report

    Set crReport = crCrystal.OpenReport(g_CRReportPath)
    crReport.DiscardSavedData
    With crReport.Database
    For i = 1 To .Tables.Count
    .Tables(i).SetLogOnInfo g_Server, g_Database, g_User, g_Pwd
    Next
    End With
    CRViewer.ReportSource = crReport
    CRViewer.ViewReport

    In fact, in CR11, if I open the report, do Verify Database and change the db there, it also doesn't work because 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.

    In my code, I tried the code suggestion above ...Item("Database Name") = g_database but I get the error Subscript out of range.

    Please help. Thanks.

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