wpf中的Microsoft报表错误? [英] Error On Microsoft Report in wpf?

查看:77
本文介绍了wpf中的Microsoft报表错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,

这是我在WPF报告中的第三天.但是我没有解决办法.噢,上帝保佑我!

我正在尝试使用Crystal Report,但是该登录问题很烦人.所以我改用了Microsoft报告,但是它也不好.

我收到此错误:

a data source instance has not been supplied for the data source ''dataset1''报告.

我的代码-

 private void Window_Loaded(object sender, RoutedEventArgs e)
        {
                dbl_cust = from recs in MainWindow.mcsEntity.mcs_custfeed
                           select recs;
                string c = dbl_cust.FirstOrDefault().mcs_CustFeed_Name.ToString();
                DataSet1 ds = new DataSet1();
                foreach (var custfee in dbl_cust)
                {
                    string cn = custfee.mcs_CustFeed_Name;
                    string cq = custfee.mcs_CustFeed_Qustion;
                    int yn = custfee.mcs_CustFeed_YesNo;
                    ds.Tables[0].Rows.Add(cn, cq, yn);
                }
 string dc = ConfigurationManager.AppSettings["Connection String"];
                ReportDataSource rds = new ReportDataSource("DataSet1",dc);
                reportViewer1.ProcessingMode = ProcessingMode.Local;
                reportViewer1.LocalReport.ReportPath = @"D:\Jagadeeswaran\Project\User\User\Report1.rdlc";
                reportViewer1.RefreshReport();
                host.Child = reportViewer1;
}
  }
        private void SetDBLogonForReport(ConnectionInfo connectionInfo, ReportDocument reportDocument)
        {
            Tables tables = reportDocument.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
            {
                TableLogOnInfo tableLogonInfo = table.LogOnInfo;
                tableLogonInfo.ConnectionInfo = connectionInfo;
                table.ApplyLogOnInfo(tableLogonInfo);
            }
        }



<window x:class="User.FeedbackReport" xmlns:x="#unknown">
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   
        xmlns:crystal="clr-namespace:CrystalDecisions.Windows.Forms;assembly=CrystalDecisions.Windows.Forms"
        xmlns:viewer="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms"
        xmlns:dalsi="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms"
        Title="FeedbackReport" Height="700" Width="1000" Loaded="Window_Loaded" xmlns:my="clr-namespace:SAPBusinessObjects.WPF.Viewer;assembly=SAPBusinessObjects.WPF.Viewer" WindowStartupLocation="CenterScreen">
    <windowsformshost name="host" margin="0,34,0,0">
        <viewer:reportviewer x:name="reportViewer1" xmlns:viewer="#unknown" />
    </windowsformshost>
</window>



在此先感谢.

我为这个错误惊呆了.他们提出了一个添加ReportDataSource的建议.但我已经做到了.

更新问题-

解决方案

ReportDataSource rds = new ReportDataSource("DataSet1",dc);


这里的第二个参数只是您的连接字符串.它实际上不是数据源.我假设您正在尝试在此处传递ds(您的数据集)而不是dc.


ljljklj gt;& amp ; [ ]>

Hi friends,

Its my 3rd day in wpf reporting. But i did not get solution. Oh god help me!

I am trying crystal report, but that login problem is irritating. So I switched to Microsoft report, but its also not fine.

I get this error :

a data source instance has not been supplied for the data source ''dataset1'' on reporting.

My code -

 private void Window_Loaded(object sender, RoutedEventArgs e)
        {
                dbl_cust = from recs in MainWindow.mcsEntity.mcs_custfeed
                           select recs;
                string c = dbl_cust.FirstOrDefault().mcs_CustFeed_Name.ToString();
                DataSet1 ds = new DataSet1();
                foreach (var custfee in dbl_cust)
                {
                    string cn = custfee.mcs_CustFeed_Name;
                    string cq = custfee.mcs_CustFeed_Qustion;
                    int yn = custfee.mcs_CustFeed_YesNo;
                    ds.Tables[0].Rows.Add(cn, cq, yn);
                }
 string dc = ConfigurationManager.AppSettings["Connection String"];
                ReportDataSource rds = new ReportDataSource("DataSet1",dc);
                reportViewer1.ProcessingMode = ProcessingMode.Local;
                reportViewer1.LocalReport.ReportPath = @"D:\Jagadeeswaran\Project\User\User\Report1.rdlc";
                reportViewer1.RefreshReport();
                host.Child = reportViewer1;
}
  }
        private void SetDBLogonForReport(ConnectionInfo connectionInfo, ReportDocument reportDocument)
        {
            Tables tables = reportDocument.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
            {
                TableLogOnInfo tableLogonInfo = table.LogOnInfo;
                tableLogonInfo.ConnectionInfo = connectionInfo;
                table.ApplyLogOnInfo(tableLogonInfo);
            }
        }



<window x:class="User.FeedbackReport" xmlns:x="#unknown">
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   
        xmlns:crystal="clr-namespace:CrystalDecisions.Windows.Forms;assembly=CrystalDecisions.Windows.Forms"
        xmlns:viewer="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms"
        xmlns:dalsi="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms"
        Title="FeedbackReport" Height="700" Width="1000" Loaded="Window_Loaded" xmlns:my="clr-namespace:SAPBusinessObjects.WPF.Viewer;assembly=SAPBusinessObjects.WPF.Viewer" WindowStartupLocation="CenterScreen">
    <windowsformshost name="host" margin="0,34,0,0">
        <viewer:reportviewer x:name="reportViewer1" xmlns:viewer="#unknown" />
    </windowsformshost>
</window>



thanks in advance.

i goggled for this error. they give one suggestion to add ReportDataSource. but i already did that.

Update Question -

解决方案

ReportDataSource rds = new ReportDataSource("DataSet1",dc);


The second parameter here is just your connection string. It''s not actually a data source. I assume you''re trying to pass ds (your DataSet) here instead of dc.


ljljkljgt;<&[]>


这篇关于wpf中的Microsoft报表错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆