我已经安装了报告查看器所需的所有软件包,但仍然显示有错误,应用所有格式路径,但仍然面临问题。
this.reportViewer1.LocalReport.ReportPath = Application.StartupPath + @"C: UsersnazirOneDriveDocumentsNazam posReportproduct.rdlc";
this.reportViewer1.LocalReport.DataSources.Clear();
DataSet1 ds = new DataSet1();
SqlDataAdapter da = new SqlDataAdapter();
cn.Open();
da.SelectCommand = new SqlCommand("select p.pcode ,p.barcode,p.pdesc,b.brand,c.category,p.purchase,p.price, p.qty, p.reorder from tblProducts as p inner join tblBrand as b on p.bid=b.id inner join tblCategory as c on p.cid=c.id ", cn);
da.Fill(ds.Tables["dtproduct"]);
cn.Close();
输入图片描述
图像显示错误
正如@Paulo Santos提到的,您应该检查ReportPath的值是否正确,在下面代码的行上设置一个断点,并检查ReportPath
的值this.reportViewer1.LocalReport.ReportPath = Application.StartupPath + @"C: UsersnazirOneDriveDocumentsNazam posReportproduct.rdlc";
另外,请修改如下代码,并检查是否有效。标记确保RDLC文件存在。
this.reportViewer1.LocalReport.ReportPath = @"C: UsersnazirOneDriveDocumentsNazam posReportproduct.rdlc";