【问题标题】:Crystal ActiveX Report Viewer 11.5 Runtime change datasourceCrystal ActiveX Report Viewer 11.5 运行时更改数据源
【发布时间】:2011-11-27 00:58:34
【问题描述】:

我正在使用 VS2008 开发窗体应用程序并尝试使用 Crystal ActiveX 报表查看器 11_5(支持高棉 Unicode)查看报表。当运行时我需要更改报表的数据源,因为 VS 2008 中的内置 Crystal Report Viewer 可以,但我总是收到此错误短信“尝试读取或写入受保护的内存。这通常表明其他内存已损坏。”

    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()

任何建议表示赞赏。

【问题讨论】:

    标签: crystal-reports


    【解决方案1】:

    这是一个旧帖子,我来宾,但在这里,你可以在 vs2008 中找到我关于这件事的文章:http://osify.com/2008/12/khmer-unicode-with-crystal-report-in-c-application/

    但是对于 vs2010,很多人只是向我报告说它不适用于我的方法,但我还没有尝试过(请参阅 osify 帖子中的 cmets)

    你也应该考虑用vs2012试试。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-09
      • 2010-09-12
      • 1970-01-01
      • 1970-01-01
      • 2012-08-26
      相关资源
      最近更新 更多