Hi,
I try to load crystal report in vs 2008 & crystal report 2008 , it show the error ,Report Logon Error Invalid report file path.
Invalid report file path.
my code:
Private Sub LoadParameters1()
Dim tblCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
Dim strSel As String
Dim ClassID As Integer = 1
Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
Try
'get report file and location from web.config
Dim RptLocation As String
RptLocation = Server.MapPath("~/Reports")
Dim RptFileName As String
RptFileName = Server.MapPath("~/Reports/MISData.rpt")
' rpt.Load(ConfigurationManager.AppSettings("RptLocation") & ConfigurationManager.AppSettings("RptFileName"))
rpt.Load(MapPath(RptFileName))
Catch lex As LoadSaveReportException
lblError.Text = "Error loading the report" & vbCrLf & lex.Message
Catch ex As Exception
lblError.Text = "General Error" & vbCrLf & ex.Message
End Try
Try
'log the Crystal Report in
For Each tblCurrent In rpt.Database.Tables
tliCurrent = tblCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
'get log in info from web.config
.ServerName = ConfigurationManager.AppSettings("SQLServer")
.DatabaseName = ConfigurationManager.AppSettings("Database")
.UserID = ConfigurationManager.AppSettings("UserId")
.Password = ConfigurationManager.AppSettings("Password")
End With
'apply the log in info
tblCurrent.ApplyLogOnInfo(tliCurrent)
Next tblCurrent
Catch ex As Exception
lblError.Visible = True
lblError.Text = "Report Logon Error" & vbCrLf & ex.Message
End Try
Try
CrystalReportViewer1.ReportSource = rpt
Catch ex As Exception
lblError.Text = "Selection Error" & vbCrLf & ex.Message
End Try
End Sub
----
Pls help..
Private Sub LoadParameters1()
Dim tblCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
'Dim strSel As String
Dim ClassID As Integer = 1
Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
Try
'get report file and location from web.config
rpt.Load(Server.MapPath("~/Reports/CrystalReport.rpt"))
Catch lex As LoadSaveReportException
lblError.Text = "Error loading the report" & vbCrLf & lex.Message
Catch ex As Exception
lblError.Text = "General Error" & vbCrLf & ex.Message
End Try
Try
'log the Crystal Report in
For Each tblCurrent In rpt.Database.Tables
tliCurrent = tblCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
'get log in info from web.config
.ServerName = ConfigurationManager.AppSettings("SQLServer")
.DatabaseName = ConfigurationManager.AppSettings("Database")
.UserID = ConfigurationManager.AppSettings("UserId")
.Password = ConfigurationManager.AppSettings("Password")
End With
'apply the log in info
tblCurrent.ApplyLogOnInfo(tliCurrent)
Next tblCurrent
Catch ex As Exception
lblError.Visible = True
lblError.Text = "Report Logon Error" & vbCrLf & ex.Message
End Try
Try
CrystalReportViewer1.ReportSource = rpt
Catch ex As Exception
lblError.Text = "Selection Error" & vbCrLf & ex.Message
End Try
End Sub
Regards,
D.Ravi
Marked as answer by Ravi_D on Apr 22, 2011 10:01 AM
Ravi_D
Participant
1212 Points
270 Posts
Crystal Report error loading the report.
Apr 22, 2011 07:05 AM|LINK
Hi, I try to load crystal report in vs 2008 & crystal report 2008 , it show the error ,Report Logon Error Invalid report file path. Invalid report file path. my code: Private Sub LoadParameters1() Dim tblCurrent As CrystalDecisions.CrystalReports.Engine.Table Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo Dim strSel As String Dim ClassID As Integer = 1 Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument() Try 'get report file and location from web.config Dim RptLocation As String RptLocation = Server.MapPath("~/Reports") Dim RptFileName As String RptFileName = Server.MapPath("~/Reports/MISData.rpt") ' rpt.Load(ConfigurationManager.AppSettings("RptLocation") & ConfigurationManager.AppSettings("RptFileName")) rpt.Load(MapPath(RptFileName)) Catch lex As LoadSaveReportException lblError.Text = "Error loading the report" & vbCrLf & lex.Message Catch ex As Exception lblError.Text = "General Error" & vbCrLf & ex.Message End Try Try 'log the Crystal Report in For Each tblCurrent In rpt.Database.Tables tliCurrent = tblCurrent.LogOnInfo With tliCurrent.ConnectionInfo 'get log in info from web.config .ServerName = ConfigurationManager.AppSettings("SQLServer") .DatabaseName = ConfigurationManager.AppSettings("Database") .UserID = ConfigurationManager.AppSettings("UserId") .Password = ConfigurationManager.AppSettings("Password") End With 'apply the log in info tblCurrent.ApplyLogOnInfo(tliCurrent) Next tblCurrent Catch ex As Exception lblError.Visible = True lblError.Text = "Report Logon Error" & vbCrLf & ex.Message End Try Try CrystalReportViewer1.ReportSource = rpt Catch ex As Exception lblError.Text = "Selection Error" & vbCrLf & ex.Message End Try End Sub ---- Pls help..D.Ravi
Ravi_D
Participant
1212 Points
270 Posts
Re: Crystal Report error loading the report.
Apr 22, 2011 10:01 AM|LINK
I got a solution
Private Sub LoadParameters1() Dim tblCurrent As CrystalDecisions.CrystalReports.Engine.Table Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo 'Dim strSel As String Dim ClassID As Integer = 1 Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument() Try 'get report file and location from web.config rpt.Load(Server.MapPath("~/Reports/CrystalReport.rpt")) Catch lex As LoadSaveReportException lblError.Text = "Error loading the report" & vbCrLf & lex.Message Catch ex As Exception lblError.Text = "General Error" & vbCrLf & ex.Message End Try Try 'log the Crystal Report in For Each tblCurrent In rpt.Database.Tables tliCurrent = tblCurrent.LogOnInfo With tliCurrent.ConnectionInfo 'get log in info from web.config .ServerName = ConfigurationManager.AppSettings("SQLServer") .DatabaseName = ConfigurationManager.AppSettings("Database") .UserID = ConfigurationManager.AppSettings("UserId") .Password = ConfigurationManager.AppSettings("Password") End With 'apply the log in info tblCurrent.ApplyLogOnInfo(tliCurrent) Next tblCurrent Catch ex As Exception lblError.Visible = True lblError.Text = "Report Logon Error" & vbCrLf & ex.Message End Try Try CrystalReportViewer1.ReportSource = rpt Catch ex As Exception lblError.Text = "Selection Error" & vbCrLf & ex.Message End Try End SubD.Ravi