我正在使用VS2008开发窗体应用程序,并尝试使用Crystal ActiveX Report Viewer 11_5(支持高棉语Unicode)查看报告。当运行时我需要更改报表的数据源作为VS 2008中的内置Crystal报表查看器可以但我总是得到此错误短信“尝试读取或写入受保护的内存。这通常表明其他内存已损坏。”
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()
任何建议表示赞赏。
答案 0 :(得分:0)
这是一篇旧帖子,我是客人,但在这里,您可以在vs2008中找到关于此事的文章:http://osify.com/2008/12/khmer-unicode-with-crystal-report-in-c-application/
但是对于vs2010,很多人只是向我报告说它没有使用我的方法,但我还没有尝试过(参见osify帖子中的评论)
您应该考虑使用vs2012来尝试。