0
votes

I am developing window form application using VS2008 and try to view report with Crystal ActiveX Report Viewer 11_5(Support Khmer Unicode). when runtime i need to change datasource of report as Build-in Crystal Report Viewer in VS 2008 can but i always got this error sms "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

    Here is my code:

    Dim FRM As New frmOtherReport
    Dim app As New CRAXDDRT.Application
    Dim rpt As CRAXDDRT.Report
    Dim tbl As CRAXDDRT.DatabaseTable
    Dim tbls As CRAXDDRT.DatabaseTables
    rpt = app.OpenReport(ReportsURL + "rptStudentListAll.rpt")        
    For Each tbl In rpt.Database.Tables
        tbl.ConnectionProperties.DeleteAll()
        tbl.ConnectionProperties.Add("Provider", "SQLOLEDB")
        tbl.ConnectionProperties.Add("Data Source", My.Settings.Datasource)
        tbl.ConnectionProperties.Add("Initial Catalog", My.Settings.Database)
        'tbl.ConnectionProperties.Add("Integrated Security", "True")   ' cut for sql authentication
        tbl.ConnectionProperties.Add("User Id", My.Settings.Username)   ' add for sql authentication
        tbl.ConnectionProperties.Add("Password", My.Settings.Password)  ' add for sql authentication
    Next tbl
    'This removes the schema from the Database Table's Location property.
    tbls = rpt.Database.Tables
    For Each tbl In tbls
        With tbl
            .Location = .Name
        End With
    Next

    'View the report
    rpt.Database.Tables(1).SetDataSource(myDataTable) 'error location
    FRM.AxCrystalActiveXReportViewer1.ReportSource = rpt
    FRM.AxCrystalActiveXReportViewer1.ViewReport()
    FRM.Show()

Any advice appreciated.

1

1 Answers

0
votes

It's an old post, I guest but here, you can find my article on this matter in vs2008: http://osify.com/2008/12/khmer-unicode-with-crystal-report-in-c-application/

But with vs2010, many people just reported to me that it is not working with my method there but I haven't tried it yet (see comments in osify post)

You should consider to use vs2012 to try as well.