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)
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
Member
22 Points
75 Posts
Crystal Report VS 2010 with Dataset Error
Apr 09, 2012 05:34 AM|Sentoso|LINK
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 :
The program stop at line : rptDoc.SetDataSource(ds)
If I debug it, ds contains data.
Please Help me
Thank you
Member
80 Points
50 Posts
Re: Crystal Report VS 2010 with Dataset Error
Apr 09, 2012 05:42 AM|thomas.watson12|LINK
you need specify the correct ServerName and user id for report connect in codebind.
refer:
http://forums.asp.net/t/1178464.aspx/1
http://vbcity.com/forums/t/165710.aspx
http://www.vbforums.com/archive/index.php/t-606432.html
http://www.java-tips.org/java-lang/2509-how-to-invoke-java-methods-using-reflection.html
Member
22 Points
75 Posts
Re: Crystal Report VS 2010 with Dataset Error
Apr 09, 2012 07:26 AM|Sentoso|LINK
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