Skip to Content
author's profile photo Former Member
Former Member

Attempted to read or write protected memory.

Can someone please help me.

I have a number of reports defined in Crystal 10 reading data tables on SQL server over an intranet.

I have created a simple windows application to view these reports using a crystal viewer object in VB.NET.

This works fine on the original target machine but when I came to install it on other machines I found that it would work on some but not others.

The error returned is

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

which changes to

Object reference not set to an instance of an object

The program is creating the exception when setting the reportsource method in the viewer.

The other thing that I have discovered is that if the report is made up of only one table it works on all machines but if there is more than one it returns this error on some.

Does anyone know why it would work on some machines but not others.

I am new to programming and this is driving me mad.


Sub SQL_Connection()
Dim crtableLogoninfos As New TableLogOnInfos()
Dim crtableLogoninfo As New TableLogOnInfo()
Dim crConnectioninfo As New ConnectionInfo()
Dim CrTables As Tables
Dim CrTable As Table

Dim rpt As New

Dim crReportDocument As New ReportDocument()

'load report and connect to database applying password to each table


With crConnectioninfo
.ServerName = "XXXXXX"
.DatabaseName = "XXXXXXXX"
.UserID = "XXXXXX"
.Password = "XXXXXX"
End With

CrTables = crReportDocument.Database.Tables

'loop through and apply logon info
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectioninfo

'view report
rptViewer.ReportSource = crReportDocument

End Sub

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on May 22, 2008 at 02:00 AM

    Hi, i'm getting the same error as u. Did u solve it ?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.