M
mv
Error Message :The instruction at "0x7c82f8c7" referenced memory at
"0x00000586". . The memory could not be "read"
Platform: Windows 2003 server sp1, Visual Studio 2005 using VB (SP1)
I developed a simple appication in vb2005, using crystal reports
ReportDocument Object. The program running fine, in debug and release mode,
but when you close the program, the above error message appears. I use the
debug mode to trace the problem, understand that some memory leakage. So I
used the close and dispose methods of Reportdocument object in Form1_Disposed
event, but the program indefenitely waiting for something. So I commented
the statements in form1_Disposed event
The following is the code,
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form1
Private northwindCustomersReport As ReportDocument
Private Sub ConfigureCrystalReports()
northwindCustomersReport = New ReportDocument()
Dim reportPath As String = Application.StartupPath & "\myReport.rpt"
northwindCustomersReport.Load(reportPath)
Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
myConnectionInfo.ServerName = "myserver"
myConnectionInfo.DatabaseName = "myDatabase"
myConnectionInfo.IntegratedSecurity = True
SetDBLogonForReport(myConnectionInfo, northwindCustomersReport)
myCrystalReportViewer.ReportSource = northwindCustomersReport
End Sub
Private Sub SetDBLogonForReport(ByVal myConnectionInfo As
ConnectionInfo, ByVal myReportDocument As ReportDocument)
Dim myTables As Tables = myReportDocument.Database.Tables
For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In
myTables
Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo
myTableLogonInfo.ConnectionInfo = myConnectionInfo
myTable.ApplyLogOnInfo(myTableLogonInfo)
Next
End Sub
Private Sub Form1_Disposed(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Disposed
'If northwindCustomersReport IsNot Nothing Then
' northwindCustomersReport.Close()
'End If
GC.Collect()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
ConfigureCrystalReports()
End Sub
End Class
"0x00000586". . The memory could not be "read"
Platform: Windows 2003 server sp1, Visual Studio 2005 using VB (SP1)
I developed a simple appication in vb2005, using crystal reports
ReportDocument Object. The program running fine, in debug and release mode,
but when you close the program, the above error message appears. I use the
debug mode to trace the problem, understand that some memory leakage. So I
used the close and dispose methods of Reportdocument object in Form1_Disposed
event, but the program indefenitely waiting for something. So I commented
the statements in form1_Disposed event
The following is the code,
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form1
Private northwindCustomersReport As ReportDocument
Private Sub ConfigureCrystalReports()
northwindCustomersReport = New ReportDocument()
Dim reportPath As String = Application.StartupPath & "\myReport.rpt"
northwindCustomersReport.Load(reportPath)
Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
myConnectionInfo.ServerName = "myserver"
myConnectionInfo.DatabaseName = "myDatabase"
myConnectionInfo.IntegratedSecurity = True
SetDBLogonForReport(myConnectionInfo, northwindCustomersReport)
myCrystalReportViewer.ReportSource = northwindCustomersReport
End Sub
Private Sub SetDBLogonForReport(ByVal myConnectionInfo As
ConnectionInfo, ByVal myReportDocument As ReportDocument)
Dim myTables As Tables = myReportDocument.Database.Tables
For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In
myTables
Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo
myTableLogonInfo.ConnectionInfo = myConnectionInfo
myTable.ApplyLogOnInfo(myTableLogonInfo)
Next
End Sub
Private Sub Form1_Disposed(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Disposed
'If northwindCustomersReport IsNot Nothing Then
' northwindCustomersReport.Close()
'End If
GC.Collect()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
ConfigureCrystalReports()
End Sub
End Class