Windows窗体的Crystal Reports Viewer无法在客户端计算机中运行

时间:2014-10-13 08:55:24

标签: .net vb.net crystal-reports crystal-reports-2010

我的Windows应用程序具有嵌入式水晶报表查看器,其中查看器在开发人员计算机中运行良好。

开发者机器有: SAP Crystal Reports,Visual Studio 2010的版本 用于.net framework 4(32位)的SAP Crystal Reports运行时引擎

我的客户端机器有: .net框架4的SAP Crystal Reports运行时引擎(32位) Ms .net framework 4 Extended和client

我在x86环境中编译了我的应用程序。我将release文件夹复制到客户端计算机,并在打开crystal report viewer表单时冻结应用程序。 它适用于所有开发人员机器。

我的代码是:

Public Sub retreiveReceiptReport()
    Dim myConnection As New OdbcConnection
    myConnection.ConnectionString = "driver={mysql odbc 3.51 driver};server=localhost;port=3307;database=aiga;uid=root;pwd=vision18"
    Dim MyCommand As New OdbcCommand
    MyCommand.Connection = myConnection
    MyCommand.CommandText = "select amount, payment_mode, receipt_no, registrarUsername, payment_from, purpose, DATE_FORMAT(receipt_date, '%d-%m-%Y') as receipt_date , tagged_to from aiga_trn_treceipt where registrarUsername = '" & main.reguserName & "' order by receipt_no desc limit 1 "
    MyCommand.CommandType = Data.CommandType.Text
    Dim MyDA As New OdbcDataAdapter
    MyDA.SelectCommand = MyCommand
    Dim myDS As New DataSet
    MyDA.Fill(myDS, "DataTable2")

    MyCommand.CommandText = "SELECT * FROM aiga.aiga_trn_registrar a where registrarUsername ='" & main.reguserName & "'"
    MyCommand.CommandType = Data.CommandType.Text
    MyDA.SelectCommand = MyCommand
    MyDA.Fill(myDS, "DataTable3")

    Dim oRpt As New ReportDocument
    Dim path As String = My.Application.Info.DirectoryPath
    oRpt.Load(path + "\receiptFormat.rpt")
    oRpt.SetDataSource(myDS)
    receiptReportViewer.ReportSource = oRpt
End Sub

我做了一个单元测试。 结果: 采用crystalreportviewer控件的单一窗口效果很好。如果从一个窗体表单导航到另一个窗体表单,则新打开的表单上会出现问题。

1 个答案:

答案 0 :(得分:3)

您是否在客户端安装了Crystal runtime for visual studio 2010?尝试安装x86和x64版本。 特别注意wiki的部署部分。