0

ページのドロップダウンリストから営業担当者を選択したときに管理パネルにレポートを表示したいのですが、何も表示されず、ここにエラーが表示されます。

以下は私のコードです:

protected void BtnViewReport_Click(object sender, EventArgs e)
{
    ReportViewer1.ProcessingMode = ProcessingMode.Local;
    ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/SalesPerson.rdlc");
    DataSet ds = GetData("select * from customer_new where salesperson in (select +
    email from Registration where name='" + ddsalesperson.SelectedValue.ToString() + 
    "')");
    ReportDataSource datasource = new ReportDataSource("customer_new",ds.Tables[0]);
    ReportViewer1.LocalReport.DataSources.Clear();
    ReportViewer1.LocalReport.DataSources.Add(datasource);
}
private DataSet GetData(string query)
{
    string conString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
    SqlCommand cmd = new SqlCommand(query);
    using (SqlConnection con = new SqlConnection(conString))
    {
        using (SqlDataAdapter sda = new SqlDataAdapter())
        {
            cmd.Connection = con;
            sda.SelectCommand = cmd;
            using (DataSet ds = new DataSet())
           {
                  sda.Fill(ds, "customer_new");
                  return ds;
            }
        }
    }
}

次のエラーが表示されます。

データ ソース 'DataSet1' のデータ ソース インスタンスが提供されていません。

4

1 に答える 1