Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I get the following error:

Attempted to access an element as a type incompatible with the array.


I want to create a report with the report viewer and then came up this error at runtime. Here is my code:

C#
inventoryInfoReport.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; inventoryInfoReport.LocalReport.ReportPath = CitronConfiguration.ReportPath + "InventoryInfoReport.rdlc";
inventoryInfoReport.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; inventoryInfoReport.LocalReport.ReportPath = CitronConfiguration.ReportPath + "InventoryInfoReport.rdlc";
InventoryInfoDataSet inventoryDataSetObj = new InventoryInfoDataSet();
IList inventoryCatalogList = new InventoryCatalogSystem().GetInventoryCatalogList();
foreach (InventoryCatalog inventoryCatalog in inventoryCatalogList)
{
DataRow row = inventoryDataSetObj.Tables[0].NewRow();
row["InventoryId"] = inventoryCatalog.InventoryId;
row["InventoryName"] = inventoryCatalog.InventoryName;
row["Stock"] = Library.DecimalToCurrency(inventoryCatalog.Stock);
row["IdealStock"] = Library.DecimalToCurrency(inventoryCatalog.IdealStock);
row["Balance"] = Library.DecimalToCurrency(inventoryCatalog.Balance);
inventoryDataSetObj.Tables[0].Rows.Add(row);
}
ReportDataSource objDataSource = new ReportDataSource("InventoryInfoDataSet_DataTable1", inventoryDataSetObj.Tables[0]);
inventoryInfoReport.LocalReport.DataSources.Add(objDataSource); //<--the error was here


Can some one help me please?
Posted
Updated 31-Oct-10 3:02am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900