部署到客户端pc vb.net时不显示crystal报表项

bfhwhh0e  于 2021-06-24  发布在  Mysql
关注(0)|答案(1)|浏览(346)

当在安装了数据库的服务器pc上运行应用程序时,它会工作并显示数据库中的项目,但当我在客户端pc上安装并运行应用程序时,它不会显示任何错误。我使用vb.net 2013社区、wamp mysql作为数据库和sap crystal report 13.0.12.1494版本,我使用odbc我的数据库连接
这是它在我的服务器pc上工作的截图

这是一个从我的客户机你可以看到我的listview正在读取和显示数据库中的项目,但当我点击打印水晶报表显示空

这是我的app config和moduleconnection中的连接字符串
应用程序配置

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
  </startup>

  <connectionStrings>
    <add name="MySqlConnectionString" connectionString="SERVER=192.168.1.2;DATABASE=payparkingsystem;UID=connect;PASSWORD=password;" />
  </connectionStrings>

</configuration>

模块连接.vb。

Imports MySql.Data.MySqlClient
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Configuration
Module ModuleConnection

    Public connString1 As String = ConfigurationManager.ConnectionStrings("MySqlConnectionString").ToString()
    Public conn As MySqlConnection = New MySqlConnection(connString1)
    Public sql As String = ""

    Public Function ExecuteQuery(ByVal query As String) As DataTable
        Dim sqlDT As New DataTable
        Try
            Dim sqlCon As New MySqlConnection(connString1)
            Dim sqlDA As New MySqlDataAdapter(query, sqlCon)
            Dim sqlCB As New MySqlCommandBuilder(sqlDA)
            sqlDA.Fill(sqlDT)
        Catch ex As Exception
        End Try
        Return sqlDT
    End Function
End Module

这是我的打印代码

Public Sub PrintEmployeeAccountsLogsSearch()
        Dim cryRpt As New ReportDocument
        cryRpt.Load("C:\Reports\CrystalReportPrintEmployeeAccountsLogsSearch.vb.rpt")
        Dim crParameterFieldDefinitions As ParameterFieldDefinitions
        Dim crParameterFieldDefinition As ParameterFieldDefinition
        Dim crParameterValues As New ParameterValues
        Dim crParameterDiscreteValue As New ParameterDiscreteValue
        crParameterDiscreteValue.Value = print
        crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
        crParameterFieldDefinition = crParameterFieldDefinitions.Item("My Parameter")
        crParameterValues = crParameterFieldDefinition.CurrentValues
        crParameterValues.Clear()
        crParameterValues.Add(crParameterDiscreteValue)
        crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
        FormPrintEmployeeAccountsLogsSearch.CrystalReportViewer1.ReportSource = cryRpt
        FormPrintEmployeeAccountsLogsSearch.CrystalReportViewer1.Refresh()
        cryRpt.PrintToPrinter(1, True, 0, 0)
    End Sub

这是我数据库的截图

我希望有人能帮我改正我的错误,任何帮助都将不胜感激,提前谢谢你和更多的有能力的家伙!

kcwpcxri

kcwpcxri1#

你从你的客户那里连接数据库了吗?

相关问题