cancel
Showing results for 
Search instead for 
Did you mean: 

Attempted to read or write protected memory.

Former Member
0 Kudos

<p>Can someone please help me.</p><p> I have a number of reports defined in Crystal 10 reading data tables on SQL server over an intranet.</p><p> I have created a simple windows application to view these reports using a crystal viewer object in VB.NET.</p><p>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.</p><p>The error returned is</p><p>Attempted to read or write protected memory. This is often an indication that other memory is corrupt.</p><p>which changes to </p><p>Object reference not set to an instance of an object</p><p>The program is creating the exception when setting the reportsource method in the viewer.</p><p>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.</p><p>Does anyone know why it would work on some machines but not others.</p><p>I am new to programming and this is driving me mad.</p><p>Thanks</p><p>Sub SQL_Connection()<br /> Dim crtableLogoninfos As New TableLogOnInfos()<br /> Dim crtableLogoninfo As New TableLogOnInfo()<br /> Dim crConnectioninfo As New ConnectionInfo()<br /> Dim CrTables As Tables<br /> Dim CrTable As Table</p><p> Dim rpt As New <br /> CrystalDecisions.CrystalReports.Engine.ReportDocument()</p><p> Dim crReportDocument As New ReportDocument()</p><p><br /> &#39;load report and connect to database applying password to each table</p><p> crReportDocument.Load(ReportPath)</p><p> With crConnectioninfo<br /> .ServerName = "XXXXXX"<br /> .DatabaseName = "XXXXXXXX"<br /> .UserID = "XXXXXX"<br /> .Password = "XXXXXX"<br /> End With</p><p> CrTables = crReportDocument.Database.Tables<br /> <br /> &#39;loop through and apply logon info<br /> For Each CrTable In CrTables<br /> crtableLogoninfo = CrTable.LogOnInfo<br /> crtableLogoninfo.ConnectionInfo = crConnectioninfo<br /> CrTable.ApplyLogOnInfo(crtableLogoninfo)<br /> Next<br /> <br /> &#39;view report<br /> rptViewer.ReportSource = crReportDocument</p><p> End Sub</p>

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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