简体   繁体   English

CrystalReportsViewer调试错误消息

[英]CrystalReportsViewer Debug Error Message

I incorporate CrystalReportsViewer in my WPF app using VS 2015. Here is my View: 我使用VS 2015将CrystalReportsViewer合并到我的WPF应用程序中。这是我的视图:

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:KnoxFactoryLoader.Views"
    xmlns:Viewer="clr-namespace:SAPBusinessObjects.WPF.Viewer;assembly=SAPBusinessObjects.WPF.Viewer" ToolTip="Production Batch Report" x:Name="ProductionBatch" x:Class="KnoxFactoryLoader.Views.Report_View"
    mc:Ignorable="d"
    WindowStartupLocation="CenterScreen"    
    Title="Production Batch Report View" Height="600" Width="700">
    <Viewer:CrystalReportsViewer Name="rptView" ShowLogo="False" ShowToolbar="True" ShowToggleSidePanelButton="False"
       ToggleSidePanel="None" Focusable="True" ShowOpenFileButton="False" 
                                 ShowCopyButton="False"  ShowRefreshButton="False" 
       HorizontalAlignment="Left" VerticalAlignment="Top"/>
   </Window>

Here is my code behind: 这是我的代码背后:

public partial class Report_View : Window
{
    public Report_View(string param1, string reportName)
    {
        CrystalDecisions.CrystalReports.Engine.ReportDocument reportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
        reportDocument.Load(reportName);
        CrystalDecisions.CrystalReports.Engine.Tables CrTables;
        CrystalDecisions.Shared.TableLogOnInfo crtableLogoninfo = new CrystalDecisions.Shared.TableLogOnInfo();
        CrystalDecisions.Shared.ConnectionInfo crConnectionInfo = new CrystalDecisions.Shared.ConnectionInfo();
        crConnectionInfo.ServerName = "ServerName1";
        crConnectionInfo.DatabaseName = "DatabaseName1";
        crConnectionInfo.UserID = "user1";
        crConnectionInfo.Password = "pass1";

        CrystalDecisions.Shared.TableLogOnInfo crtableLogoninfo2 = new CrystalDecisions.Shared.TableLogOnInfo();
        CrystalDecisions.Shared.ConnectionInfo crConnectionInfo2 = new CrystalDecisions.Shared.ConnectionInfo();
        crConnectionInfo2.ServerName = "ServerName2";
        crConnectionInfo2.DatabaseName = "DatabaseName2";
        crConnectionInfo2.UserID = "user2";
        crConnectionInfo2.Password = "pass2";

        CrTables = reportDocument.Database.Tables;
        foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
        {
            if (CrTable.Name.Equals("TABLE1"))
            {
                crtableLogoninfo2 = CrTable.LogOnInfo;
                crtableLogoninfo2.ConnectionInfo = crConnectionInfo2;
                CrTable.ApplyLogOnInfo(crtableLogoninfo2);
            }
            else
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }
        }
        reportDocument.SetParameterValue("Param1", param1);
        InitializeComponent();
        rptView.ViewerCore.ReportSource = reportDocument;
        var viewer = rptView as SAPBusinessObjects.WPF.Viewer.CrystalReportsViewer;
        if (viewer != null)
        {
            viewer.Focusable = true;
            viewer.Focus();
        }
    }

The report created is correct. 创建的报告是正确的。 However, there are a lot of debug error messages. 但是,有很多调试错误消息。

System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; System.Windows.Data错误:5:BindingExpression生成的值对于目标属性无效。 Value='' BindingExpression:Path=ToolTip; 值=''BindingExpression:Path =工具提示; DataItem='Button' (Name='btnOpen'); DataItem ='按钮'(名称='btnOpen'); target element is 'Button' (Name='btnOpen'); 目标元素是'Button'(Name ='btnOpen'); target property is 'Name' (type 'String') System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; 目标属性为“名称”(类型为“字符串”)System.Windows.Data错误:5:由BindingExpression生成的值对于目标属性无效。 Value='' BindingExpression:Path=ToolTip; 值=''BindingExpression:Path =工具提示; DataItem='Button' (Name='btnPrint'); DataItem ='按钮'(名称='btnPrint'); target element is 'Button' (Name='btnPrint'); 目标元素是“按钮”(名称=“ btnPrint”); target property is 'Name' (type 'String') System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; 目标属性为“名称”(类型为“字符串”)System.Windows.Data错误:5:由BindingExpression生成的值对于目标属性无效。 Value='' BindingExpression:Path=ToolTip; 值=''BindingExpression:Path =工具提示; DataItem='Button' (Name='btnRefresh'); DataItem ='按钮'(名称='btnRefresh'); target element is 'Button' (Name='btnRefresh'); 目标元素是“按钮”(名称=“ btnRefresh”); target property is 'Name' (type 'String') System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; 目标属性为“名称”(类型为“字符串”)System.Windows.Data错误:5:由BindingExpression生成的值对于目标属性无效。 Value='' BindingExpression:Path=ToolTip; 值=''BindingExpression:Path =工具提示; DataItem='Button' (Name='btnExport'); DataItem ='按钮'(名称='btnExport'); target element is 'Button' (Name='btnExport'); 目标元素是“按钮”(名称=“ btnExport”); target property is 'Name' (type 'String') System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; 目标属性为“名称”(类型为“字符串”)System.Windows.Data错误:5:由BindingExpression生成的值对于目标属性无效。 Value='' BindingExpression:Path=ToolTip; 值=''BindingExpression:Path =工具提示; DataItem='Button' (Name='btnCopy'); DataItem ='按钮'(名称='btnCopy'); target element is 'Button' (Name='btnCopy'); 目标元素是“按钮”(名称=“ btnCopy”); target property is 'Name' (type 'String') System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; 目标属性为“名称”(类型为“字符串”)System.Windows.Data错误:5:由BindingExpression生成的值对于目标属性无效。 Value='' BindingExpression:Path=ToolTip; 值=''BindingExpression:Path =工具提示; DataItem='ToggleButton' (Name='btnToggleSidePanel'); DataItem ='ToggleButton'(Name ='btnToggleSidePanel'); target element is 'ToggleButton' (Name='btnToggleSidePanel'); 目标元素是'ToggleButton'(Name ='btnToggleSidePanel'); target property is 'Name' (type 'String') System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; 目标属性为“名称”(类型为“字符串”)System.Windows.Data错误:5:由BindingExpression生成的值对于目标属性无效。 Value='' BindingExpression:Path=ToolTip; 值=''BindingExpression:Path =工具提示; DataItem='Button' (Name='btnPrevPage'); DataItem ='按钮'(名称='btnPrevPage'); target element is 'Button' (Name='btnPrevPage'); 目标元素是“按钮”(名称=“ btnPrevPage”); target property is 'Name' (type 'String') System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; 目标属性为“名称”(类型为“字符串”)System.Windows.Data错误:5:由BindingExpression生成的值对于目标属性无效。 Value='' BindingExpression:Path=ToolTip; 值=''BindingExpression:Path =工具提示; DataItem='Button' (Name='btnNextPage'); DataItem ='按钮'(名称='btnNextPage'); target element is 'Button' (Name='btnNextPage'); 目标元素是“按钮”(名称=“ btnNextPage”); target property is 'Name' (type 'String') System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; 目标属性为“名称”(类型为“字符串”)System.Windows.Data错误:5:由BindingExpression生成的值对于目标属性无效。 Value='' BindingExpression:Path=ToolTip; 值=''BindingExpression:Path =工具提示; DataItem='Button' (Name=''); DataItem ='按钮'(名称=''); target element is 'Button' (Name=''); 目标元素是'Button'(Name =''); target property is 'Name' (type 'String') System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; 目标属性为“名称”(类型为“字符串”)System.Windows.Data错误:5:由BindingExpression生成的值对于目标属性无效。 Value='' BindingExpression:Path=ToolTip; 值=''BindingExpression:Path =工具提示; DataItem='Button' (Name=''); DataItem ='按钮'(名称=''); target element is 'Button' (Name=''); 目标元素是'Button'(Name =''); target property is 'Name' (type 'String') 目标属性为“名称”(类型为“字符串”)

I search SAP website and couldn't find a solution. 我搜索SAP网站,但找不到解决方案。

Thank you in advance. 先感谢您。

This is known problem with Crystal Report Viewer and WPF. 这是Crystal Report Viewer和WPF的已知问题。 You can add following code to avoid this error: 您可以添加以下代码来避免此错误:

public partial class Report_View : Window
{
    public Report_View(string param1, string reportName)
    {
        System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = System.Diagnostics.SourceLevels.Critical;
        CrystalDecisions.CrystalReports.Engine.ReportDocument reportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
        reportDocument.Load(reportName);
        ...

More info you can find here . 您可以在此处找到更多信息。

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

相关问题 C#软件调试问题中的错误消息 - Error message in C# software debug question 如何向调试器发送错误消息并停止调试? - How to send an error message to the Debugger and stopping the debug? CrystalReportsViewer,Firefox和没有工具栏 - CrystalReportsViewer, Firefox and no toolbars WPF CrystalReportsViewer:更改侧栏的位置 - WPF CrystalReportsViewer: Change position of sidebar 有关调试此错误消息“&#39;/&#39;应用程序中的服务器错误”的步骤的指南 - Guidance on steps to debug this error message “Server Error in '/' Application” 为什么 Debug.Assert 即使长度一直为 1 也会显示错误消息? - Why the Debug.Assert show the error message even if the Length is 1 all the time? Debug.Assert-s使用相同的错误消息。 我应该将它提升为静态变量吗? - Debug.Assert-s use the same error message. Should I promote it to a static variable? 请调试错误消息。 DbArithmeticExpression Arguements必须具有数字公共类型 - Debug error message please. DbArithmeticExpression Arguements must have a numeric common type CrystalReportsViewer-单击参数加载/确认按钮后触发事件 - CrystalReportsViewer - Fire Event after parameters loaded/confirm button clicked wpf:在工具箱中添加“ CrystalReportsViewer”控件时出现异常 - wpf: getting exception while adding “CrystalReportsViewer” control from Toolbox
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM