我的windows应用程序有一个嵌入式水晶报表查看器,该查看器在开发人员机器中运行良好。
开发人员机器具有:SAP Crystal Reports,Visual Studio 2010版本用于.net框架4(32位)的SAP Crystal Reports运行时引擎
我的客户端机器具有:用于.net框架4(32位)的SAP Crystal Reports运行时引擎Ms.net框架4扩展和客户端
我在x86环境中编译了我的应用程序。我将发布文件夹复制到客户端机器上,当打开crystal报表查看器窗体时,应用程序将冻结。它在所有开发人员机器中都能很好地工作。
我的代码是:
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控件的单窗口窗体运行良好。如果有从一个窗口窗体到另一个窗口表单的导航,则新打开的窗体上的问题仍然存在。
您是否在客户端上安装了visual studio 2010的Crystal运行时?请尝试同时安装x86和x64版本。请特别注意wiki的部署部分。