C# 如何使用内部连接查询生成Crystal报表并在C中填充数据集#

C# 如何使用内部连接查询生成Crystal报表并在C中填充数据集#,c#,sql,.net,visual-studio,crystal-reports,C#,Sql,.net,Visual Studio,Crystal Reports,我试图从三个不同的表中获取数据 即客户、订单和发票 此查询在SQL查询分析器中运行得非常好 SELECT invoice.invoiceId, customer.customerName, customer.businessName,customer.mobileNumber,invoice.remaining, invoice.total FROM customer INNER JOIN invoice ON customer.customerId = invoice.customerId I

我试图从三个不同的表中获取数据

客户订单发票

此查询在SQL查询分析器中运行得非常好

SELECT invoice.invoiceId, customer.customerName, customer.businessName,customer.mobileNumber,invoice.remaining, invoice.total FROM customer INNER JOIN invoice ON customer.customerId = invoice.customerId INNER JOIN orders ON customer.customerId = orders.customerId  where invoice.remaining > 1 AND customer.clientCode IS NULL and orders.[dateTime] between '15/01/2016' and '17/01/2016';
但当我尝试对Crystal Report执行此查询时,它会多次返回许多结果。请帮助:(

这是我的C代码#

using System;
using System.Data;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportSource;
using System.Collections;

namespace WindowsFormsApplication2
{
  public partial class creditCustomers : Form
   {
    ReportDocument cryrpt5 = new ReportDocument();

    public creditCustomers()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=markcreations;Integrated Security=True");
        con.Open();
        SqlDataAdapter sda1 = new SqlDataAdapter("SELECT invoice.invoiceId, customer.customerName, customer.businessName,customer.mobileNumber,invoice.remaining, invoice.total FROM customer INNER JOIN invoice ON customer.customerId = invoice.customerId INNER JOIN orders ON customer.customerId = orders.customerId  where invoice.remaining > 1 AND customer.clientCode IS NULL and orders.[dateTime] between '15/01/2016' and '17/01/2016'", con);
        DataSet dst = new DataSet();
        sda1.Fill(dst, "invoice");
        cryrpt5.Load(@"I:\My First Software\WindowsFormsApplication2\WindowsFormsApplication2\CrystalReport5.rpt");
        cryrpt5.SetDataSource(dst);
        crystalReportViewer1.ReportSource = cryrpt5;
    }
  }
}