I am trying to create a .net app to run a crystal report and keep receiving an error when I try to login into the report. My crystal report is already created and is using a stored procedure that is run on a SQL server. I am attaching my code and the error that I receive when debugging. Any help would be appreciated.
Imports System.ComponentModel
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports Everbank.Utility
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents CrystalReportViewer1 As CrystalDecisions.Windows.Forms.CrystalReportViewer
Friend WithEvents reportDocument1 As CrystalDecisions.CrystalReports.Engine.ReportDocument
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.CrystalReportViewer1 = New CrystalDecisions.Windows.Forms.CrystalReportViewer
Me.reportDocument1 = New CrystalDecisions.CrystalReports.Engine.ReportDocument
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'CrystalReportViewer1
'
Me.CrystalReportViewer1.ActiveViewIndex = -1
Me.CrystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill
Me.CrystalReportViewer1.Location = New System.Drawing.Point(0, 0)
Me.CrystalReportViewer1.Name = "CrystalReportViewer1"
Me.CrystalReportViewer1.ReportSource = Nothing
Me.CrystalReportViewer1.Size = New System.Drawing.Size(672, 326)
Me.CrystalReportViewer1.TabIndex = 0
'
'reportDocument1
'
Me.reportDocument1.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.DefaultPaperOrientation
Me.reportDocument1.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.DefaultPaperSize
Me.reportDocument1.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Upper
Me.reportDocument1.PrintOptions.PrinterDuplex = CrystalDecisions.Shared.PrinterDuplex.Default
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(520, 0)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = "TextBox1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(672, 326)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.CrystalReportViewer1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim oRpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim oTable As CrystalDecisions.CrystalReports.Engine.Table
Dim oLogin As CrystalDecisions.Shared.TableLogOnInfo
Dim ParameterFieldDefinitions As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions
Dim sServerName As String
For Each oTable In oRpt.Database.Tables
oLogin = oTable.LogOnInfo
oLogin.ConnectionInfo.Password = "REPORT"
oLogin.ConnectionInfo.UserID = "WC_REPORT"
oTable.ApplyLogOnInfo(oLogin)
Next
oRpt.Load("..\MyReport.rpt")
CrystalReportViewer1.ReportSource = "..\MyReport.rpt"
oRpt.PrintToPrinter(1, False, 0, 0)
End Sub
End Class
Here is the errors that I get when I try debugging the code...
'DefaultDomain': Loaded 'c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols loaded.
'WindowsApplication2': Loaded 'C:\Documents and Settings\ckohrman\My Documents\Visual Studio Projects\WindowsApplication2\bin\WindowsApplication2.exe', Symbols loaded.
'WindowsApplication2.exe': Loaded 'c:\windows\assembly\gac\system.windows.forms\1.0.5000.0__b77a5c561934e089\system.windows.forms.dll', No symbols loaded.
'WindowsApplication2.exe': Loaded 'c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll', No symbols loaded.
'WindowsApplication2.exe': Loaded 'c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll', No symbols loaded.
'WindowsApplication2.exe': Loaded 'c:\windows\assembly\gac\crystaldecisions.windows.forms\9.2.3300.0__692fbea5521e1304\crystaldecisions.windows.forms.dll', No symbols loaded.
'WindowsApplication2.exe': Loaded 'c:\windows\assembly\gac\crystaldecisions.crystalreports.engine\9.1.5000.0__692fbea5521e1304\crystaldecisions.crystalreports.engine.dll', No symbols loaded.
'WindowsApplication2.exe': Loaded 'c:\windows\assembly\gac\crystaldecisions.shared\9.1.5000.0__692fbea5521e1304\crystaldecisions.shared.dll', No symbols loaded.
'WindowsApplication2.exe': Loaded 'c:\windows\assembly\gac\crystaldecisions.shared\9.2.3300.0__692fbea5521e1304\crystaldecisions.shared.dll', No symbols loaded.
'WindowsApplication2.exe': Loaded 'c:\windows\assembly\gac\crystaldecisions.reportsource\9.2.3300.0__692fbea5521e1304\crystaldecisions.reportsource.dll', No symbols loaded.
'WindowsApplication2.exe': Loaded 'c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll', No symbols loaded.
'WindowsApplication2.exe': Loaded 'c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll', No symbols loaded.
'WindowsApplication2.exe': Loaded 'c:\windows\assembly\gac\crystalkeycodelib\9.1.5000.0__692fbea5521e1304\crystalkeycodelib.dll', No symbols loaded.
'WindowsApplication2.exe': Loaded 'c:\documents and settings\ckohrman\my documents\visual studio projects\windowsapplication2\bin\everbank.utility.dll', Symbols loaded.
'WindowsApplication2.exe': Loaded 'c:\windows\assembly\gac\microsoft.visualbasic\7.0.5000.0__b03f5f7f11d50a3a\microsoft.visualbasic.dll', No symbols loaded.
An unhandled exception of type 'CrystalDecisions.CrystalReports.Engine.LoadSaveReportException' occurred in crystaldecisions.crystalreports.engine.dll
Additional information: Invalid report file path.
Unhandled Exception: CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Invalid report file path.
at .F(String , EngineExceptionErrorID
)
at .B(String , Int32 )
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String reportName, OpenReportMethod openMethod, Int16 parentJob)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.'()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.get_Database()
at WindowsApplication2.Form1.Form1_Load(Object sender, EventArgs e) in C:\Documents and Settings\ckohrman\My Documents\Visual Studio Projects\WindowsApplication2\Form1.vb:line 103
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WindowsApplication2.Form1.Main() in C:\Documents and Settings\ckohrman\My Documents\Visual Studio Projects\WindowsApplication2\Form1.vb:line 6The program '[3824] WindowsApplication2.exe' has exited with code 0 (0x0).