Hello Team, I developed C# windowform Application and the print reportview is working perfectly but after a publish it and when I want to print data, I get this ERROR: Value cannot be null.
Parameter name:dataTable
In the report properties I change the follow.
Build Action: Content
Copy to Output: Copy Always
This is my report code
public void LoadReport()
{
ReportDataSource rptDS;
try
{
reportViewer1.LocalReport.ReportPath = Application.StartupPath + @"\ReportData\rptInventory.rdlc";
reportViewer1.LocalReport.DataSources.Clear();
AtteyDataSet3 ds = new AtteyDataSet3();
SqlDataAdapter da = new SqlDataAdapter();
cn.Open();
da.SelectCommand = new SqlCommand("select p.pcode, p.barcode, p.pdescription, b.brand, c.category, p.price, p.qty, p.reorder from tblProduct 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["dtInventory"]);
cn.Close();
rptDS = new ReportDataSource("AtteyDataSet3", ds.Tables["dtInventory"]);
reportViewer1.LocalReport.DataSources.Add(rptDS);
reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
reportViewer1.ZoomMode = ZoomMode.Percent;
reportViewer1.ZoomPercent= 100;
}catch(Exception ex)
{
cn.Close();
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
