Results 1 to 2 of 2

Thread: [RESOLVED] Crystal 9 VS 2008

  1. #1

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Resolved [RESOLVED] Crystal 9 VS 2008

    I have a viewer (crViewer) set up in my program. the program imports CrystalDecisions.CrystalReports.Engine & CrystalDecisions.Shared.

    I am getting an error (on the last line of the following code). "An error occurred. The data necessary to complete this operation is not yet available. (Exception from HRESULT: 0x8000000A)"

    Code:
    Private Sub SetDBLogonForReport(ByVal myConnecionInfo As ConnectionInfo)
            Try
                Dim myTableLogoninfos As New TableLogOnInfos
                Dim myTableLogoninfo As New TableLogOnInfo
                Dim crTables As Tables
                Dim crTable As Table
                Dim crReportDocument As New ReportDocument()
                crReportDocument.Load(glbReportname)
    
    
                crTables = crReportDocument.Database.Tables
    
                For Each crTable In crTables
                    myTableLogoninfo = crTable.LogOnInfo
                    myTableLogoninfo.ConnectionInfo = myConnecionInfo
                    crTable.ApplyLogOnInfo(myTableLogoninfo)
                Next
                CRViewer1.ReportSource = crReportDocument
            Catch ex As Exception
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
                MsgBox("An error occurred: " & Err.Description & " - Source: (CRViewer)SetDBLogonForReport")
            End Try
    
        End Sub
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

  2. #2
    Frenzied Member
    Join Date
    May 2006
    Location
    some place in the cloud
    Posts
    1,886

    Re: Crystal 9 VS 2008

    The next code is working ok-->
    Code:
    Dim CRReport As CrystalDecisions.CrystalReports.Engine.ReportDocument
    Dim CRTable As CrystalDecisions.CrystalReports.Engine.Table
    Dim CRTLI As CrystalDecisions.Shared.TableLogOnInfo
    
        CRReport = New CrystalDecisions.CrystalReports.Engine.ReportDocument
        CRReport.Load("MyReport.rpt", CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy)
        
        For Each CRTable In CRReport.Database.Tables
            CRTLI = CRTable.LogOnInfo
    
            With CRTLI.ConnectionInfo
                .ServerName = "ServerX"
                .UserID = "sa"
                .Password = "xxxxxx"
                .DatabaseName = "DataBaseX"
            End With
    
            CRTable.ApplyLogOnInfo(CRTLI)
    
        Next CRTable
    Check the content of your variable 'myConnecionInfo'
    JG
    Last edited by jggtz; Feb 17th, 2011 at 04:19 PM.

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