Wpf 同一报表中有多个具有差异数据集的表

Wpf 同一报表中有多个具有差异数据集的表,wpf,report,microsoft-reporting,Wpf,Report,Microsoft Reporting,我想在同一个报表中添加两个表,每个表绑定数据库中不同表中的数据 我尝试使一个数据集包含两个数据库表,并将列分配给报表中的不同表,如下所示: rptViewer.LocalReport.DataSources.Clear(); rptViewer.LocalReport.DataSources.Add(new ReportDataSource("reportDS", getData())); //reportDS the dataset cretated with rep

我想在同一个报表中添加两个表,每个表绑定数据库中不同表中的数据

我尝试使一个数据集包含两个数据库表,并将列分配给报表中的不同表,如下所示:

rptViewer.LocalReport.DataSources.Clear();
            rptViewer.LocalReport.DataSources.Add(new ReportDataSource("reportDS", getData()));  //reportDS the dataset cretated with report

            rptViewer.LocalReport.ReportPath = @"../../portifolioReport.rdlc";  

            rptViewer.RefreshReport();  

private DataTable getData()
    {
        SqlCeCommand cmd = new SqlCeCommand("select * from portifolio where patient_NID='"+NIDTxtBox4.Text+"'", con);
        SqlCeCommand cmd2 = new SqlCeCommand("select * from patients where NID='"+NIDTxtBox4.Text+"'", con);
        DataSet1.DataTable1DataTable dt = new DataSet1.DataTable1DataTable();
          SqlCeDataAdapter dscmd = new SqlCeDataAdapter(cmd);
        SqlCeDataAdapter dscmd2 = new SqlCeDataAdapter(cmd2);
          dscmd.Fill(dt);
          dscmd2.Fill(dt);
        return dt ;

    }
但在报告中,在一个表中添加的每一行都有一个问题,即在另一个表中添加了空行

我正在使用microsoft report,wpf
有人能帮我吗?

也许你可以加入选择:

select
    *
from
    patients a
        inner join
    portifolio b
            on a.patient_NID = b.NID

这将把两张桌子放在一起。您还有其他连接选项,例如:左连接、右连接、交叉连接每一个都取决于您的需要。我需要更多关于您将要显示的信息之间关系的详细信息。

当我使用join时,同样的问题也存在,但有重复的行而不是空行。报告显示患者数据,因此顶部表格显示姓名、年龄、年龄等基本数据,性别和底部显示每次就诊的患者日志和处方