简体   繁体   English

VB.NET-部署Crystal Report应用程序

[英]VB.NET - Deploying Crystal Report Application

I have tested my program on my PC, and everything works OK, however when I attempt to Deploy the Windows Form Application to Client machine Crystal Reports Window pops up asking for PASSWORD, despit the fact that have set this using: 我已经在PC上测试了程序,并且一切正常,但是,当我尝试将Windows窗体应用程序部署到客户端计算机时,弹出Crystal Reports窗口,要求输入PASSWORD,请使用以下命令取消设置该事实:

Dim cryRpt As New ReportDocument
        Dim crtableLogoninfos As New TableLogOnInfos
        Dim crtableLogoninfo As New TableLogOnInfo
        Dim crConnectionInfo As New ConnectionInfo
        Dim CrTables As Tables
        Dim CrTable As Table

        cryRpt.Load("C:\ActivityReport.rpt")

        cryRpt.SetParameterValue("FromDate", TextBox1.Text)
        cryRpt.SetParameterValue("ToDate", TextBox2.Text)

        With crConnectionInfo
            .ServerName = serverbox.Text
            .DatabaseName = dbbox.Text
            .UserID = userbox.Text
            .Password = passwordbox.Text
        End With

        CrTables = cryRpt.Database.Tables
        For Each CrTable In CrTables
            crtableLogoninfo = CrTable.LogOnInfo
            crtableLogoninfo.ConnectionInfo = crConnectionInfo
            CrTable.ApplyLogOnInfo(crtableLogoninfo)
        Next

        CrystalReportViewer1.ReportSource = cryRpt
        CrystalReportViewer1.Refresh()

I have also noticed that the DATABASE Field is Blank in the Crystal Reports Pop Up which would explain why I get the Error : LOGIN FAILED when inputting the password manually, but cant figure out why the Database Name is not being passed. 我还注意到,Crystal Reports弹出窗口中的DATABASE字段为空,这将解释为什么在手动输入密码时出现错误:LOGIN FAILED的原因,但无法弄清楚为什么未传递数据库名称。

I have tried changing the DATABASE name on my form (ON DEV PC) which is in dbbox.text and this does stop the report from running so it should be passing the DATABASE as part of the Connection String? 我试过更改dbbox.text中的窗体(在DEV PC上)上的DATABASE名称,这确实阻止了报表的运行,因此它应该将DATABASE作为连接字符串的一部分传递?

I have installed Crystal Report Viewer on the Client machine as I though it may be this, but no luck. 我已经在客户端计算机上安装了Crystal Report Viewer,尽管可能是这样,但是没有运气。 Do I need to install .NET v4 possibly ?? 我是否需要安装.NET v4?

Really Stuck now, and would love a bit of guidance. 现在真的被卡住了,并且希望得到一些指导。

Thanks Rob 谢谢罗布

I just use: 我只用:

 crDocument.SetDatabaseLogon("name", "password", "server", "database")

I've avoided those issues simply using that instead of all of that above code you have. 我避免了仅使用该代码而不是上面所有代码的那些问题。 I've ran into the same issues and it drove me crazy. 我遇到了同样的问题,这让我发疯。

Someone here probably knows why, but what I posted above, works for me. 这里的某人可能知道为什么,但是我上面发布的内容对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM