如何解决RDLC中的“报表项目未链接到数据集”错误?

Ezh*_*lan 3 c# asp.net visual-studio-2010 reporting-services

我正在使用Visual Studio 2010,并且没有使用报表向导就创建了rdlc报表,并向其中添加了数据集,但是当我右键单击文本框时,选择表达式,然后导航到数据集,我可以看到我的数据集已添加到报表中,但是当我单击显示“报告项目未链接到数据集”的字段。我在VS 2008中没有遇到这个问题,报告在其中可以正常工作。我不知道如何在VS2010中解决此问题。所以有人可以帮我解决这个问题。我已附上以下问题的屏幕截图。请检查一下。

数据集未填充的字段

使用数据集时出错

我在下面显示了用于在表中显示值的代码,但我想知道如何在文本框而不是表中显示值。

protected void Page_Load(object sender, EventArgs e)
{
    LocalReport lr = null;
    DataSet ds = new DataSet();
    con.Open();
    SqlCommand cmd = new SqlCommand();
    SqlDataAdapter da = new SqlDataAdapter("Select CatalogNo as CatalogNo, Productname as ProductName, Quality_Plan_Ref_No as QPRefNo,Drawing_No as DrawingNo,ISR_No as ISRNo,BatchNo as BatchNo,Allotted_Qty as AllottedQty,CONVERT(VARCHAR(10),Allotted_Date,105) as AllottedDate from Batch_Allott where CatalogNo='0464' ", con);
    da.Fill(ds, "temp");
    ReportViewer1.LocalReport.DataSources.Clear();
    ReportViewer1.ProcessingMode = ProcessingMode.Local;
    lr = ReportViewer1.LocalReport;
    lr.ReportPath = "Report1.rdlc";
    lr.DataSources.Add(new ReportDataSource("Dataset1_Batch_Allott", ds.Tables[0]));
}
Run Code Online (Sandbox Code Playgroud)

小智 5

选择Tablix,然后右键单击左上方的Square。选择Tablix Properties

Tablix Properties窗口中,确保已Dataset选择您的姓名。

删除上一个文件后,我遇到了这个问题,Dataset并将其留为空白。如果你没有看到在下拉一个你可能需要去View|Report DataRefresh它。