我使用的是 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]));
}
最佳答案
选择 Tablix
,然后右键单击左上角的 Square。选择 Tablix 属性
。
在 Tablix Properties
窗口中,确保您选择了 Dataset
名称。
这个问题是我把之前的Dataset
删掉后留空的。如果您在下拉列表中没有看到,您可能需要转到View|Report Data
并Refresh
。
关于c# - 如何解决RDLC中的 "Report item not linked to Dataset"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27242545/