locked
Crystal Report VS 2010 with Dataset Error RRS feed

  • Question

  • User-1330485181 posted

    Hi,

    I am using Visual Studio 2010 with Crsytal Report for VS 2010. When I run the code, It produces an error like this below :

    Failed to load database information.
    Error in File xxxx {7474F8A4-CF6B-4D86-9572-96712F76FB40}.rpt:
    Failed to load database information.

    Here is the code that I made :

           

            Dim sRptSource As String = ""
            sRptSource = "E:\ProgramTCK\Demurrage\Demurage\RptDemurrage.rpt"
    
            Dim frmP As New Demurage.frmRptViewer()
            Dim rptDoc As New ReportDocument()
    
            Try
                
                Dim sConStr As String = My.Settings.DemurrageConnectionString
                Dim connDB As OleDbConnection
                Dim sSQL = "select * from qryDemurrage where BlnThnVoy >= '" & sPeriode1 & "' and BlnThnVoy <= '" & sPeriode2 & "'"
    
                connDB = New OleDbConnection(sConStr)
                connDB.Open()
    
                Dim ds As New DataSet()
                Dim sCMD As New OleDbCommand(sSQL, connDB)
                sCMD.CommandTimeout = 1000
                Dim da As New OleDbDataAdapter(sCMD)
    
                da.Fill(ds, sSQL)
    
                rptDoc.Load(sRptSource)
    
                rptDoc.SetDataSource(ds)
    
                frmP.CrystalReportViewer1.ReportSource = rptDoc
                frmP.CrystalReportViewer1.ShowRefreshButton = True
                frmP.CrystalReportViewer1.RefreshReport()
                frmP.Show()
                
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
            '


    The program stop at line : rptDoc.SetDataSource(ds)

    If I debug it, ds contains data. 

    Please Help me

    Thank you

    Monday, April 9, 2012 5:34 AM

All replies

  • User-1330485181 posted

    Thank Thomas for the reply, but in my program I used database Access (mdb) with no user id and password. I have added the ServerName like the code below but It still don't work

    Dim sRptSource As String = ""
            sRptSource = "E:\ProgramTCK\Demurrage\Demurage\RptDemurrage.rpt"
    
            Dim frmP As New Demurage.frmRptViewer()
            Dim rptDoc As New ReportDocument()
    
            Try
                
                Dim sConStr As String = My.Settings.DemurrageConnectionString
                Dim connDB As OleDbConnection
                Dim sSQL = "select * from qryDemurrage where BlnThnVoy >= '" & sPeriode1 & "' and BlnThnVoy <= '" & sPeriode2 & "'"
    
                connDB = New OleDbConnection(sConStr)
                connDB.Open()
    
                Dim ds As New DataSet()
                Dim sCMD As New OleDbCommand(sSQL, connDB)
                sCMD.CommandTimeout = 1000
                Dim da As New OleDbDataAdapter(sCMD)
    
                da.Fill(ds, sSQL)
    
                rptDoc.Load(sRptSource)
                
                Dim myDBConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo()
    
                With myDBConnectionInfo
    
                    .ServerName = "localhost"
                    .DatabaseName = "E:\ProgramTCK\Demurrage\Demurage\Demurrage.mdb"
                    .UserID = ""
                    .Password = ""
    
                End With
                
                rptDoc.SetDataSource(ds)
                
                frmP.CrystalReportViewer1.ReportSource = rptDoc
                frmP.CrystalReportViewer1.ShowRefreshButton = True
                frmP.CrystalReportViewer1.RefreshReport()
                frmP.Show()
                
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
            



    Monday, April 9, 2012 7:26 AM