Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    El Salvador

    Unanswered: Database Connection

    Hi, I've got one problem.. I've made a couple of reports using visual basic .net 2003 and crystal reports. The reports get their data from stored procedures in a database called DB1 for example. I connect to the database using ODBC and so that the report doesn't ask me for login/password at runtime I use the following code:

        Private Sub ConfigureCrystalReports()
            reporte = New rptReport1
            Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo
            myConnectionInfo.ServerName = "REPORTES"
            myConnectionInfo.DatabaseName = "DB1"
            myConnectionInfo.UserID = "sa"
            myConnectionInfo.Password = "XXX"
            SetDBLogonForReport(myConnectionInfo, reporte)
        End Sub
        Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo, ByVal myReportDocument As ReportDocument)
            Dim myTables As Tables = myReportDocument.Database.Tables
            Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
            For Each myTable In myTables
                Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo
                myTableLogonInfo.ConnectionInfo = myConnectionInfo
                myTableLogonInfo.ConnectionInfo.DatabaseName = myConnectionInfo.DatabaseName
        End Sub
    Now I want the report to get the information from a second database that has the same tables, stored procedures, etc. called DB2, but changing the code to myConnectionInfo.DatabaseName = "DB2" doesn't work. Anyone have any ideas?

  2. #2
    Join Date
    Oct 2005
    you need another connection variable like

    Dim myConnectionInfo2 As ConnectionInfo = New ConnectionInfo

    for db2

  3. #3
    Join Date
    Feb 2004
    El Salvador
    It doesn't work that way either...

  4. #4
    Join Date
    Mar 2004
    I had also faced this problem in only crystal report 9, while not in crystal reprot 8
    but now I feel crystal report 9 service pack 5 free available,It may fix problem
    but some year ago when crystal report 9 was newly interduced I could not fix
    then I found one thing
    if we have to change our report loaction in deisgn time..some time I made copies of report with differnt server name, and db but , structure were interesting same
    please if you found its solution tell me..but now a days I m working in Crystal Report 8. so I did not try to search this problem

Posting Permissions

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