Hi, It is kind of hard to post all my actual codes here because I am working from rather complicated business objects. Here is a simplified model.
public partial class ReportViewer : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
IList<Order> myOrderList = GetFromBO.GetOrders();
Report myReport = new ReportLibrary.MyOrderReport;
myReport.DateSource = myOrderList;
this.ReportViewer1.Report = myReport;
}
}
class GetFromBO {
public IList<Order> GetOrders() {
ILIst<Order> orderList = new List<Order>;
Order order;
//fill the IList<Order> with orders
//...
orderList.Add(order)
//...
orderList.Add(order)
//...
return orderList;
}
}
class Order {
public int OrderID;
public datetime OrderShipDate;
public IList<OrderDetail> OrderDetails;
....
}
}
class OrderDetail {
public int OrderDetailID;
Public Item item;
public int Quantity;
....
}
class Item {
public int ItemID ;
public string ItemName ;
public datetime AvailableDate ;
....
}
The myReport will display List<Order>.OrderShipDate, as well as List<Order>.OrderDetails.Item.AvailableDate.
Here is the error message "Cannot set Column 'OrderShipDate' to be null.Please use DBNull instead". I believed it was caused by Nullable database field of [Order.OrderShipDate] or [Item.AvailableDate].
Please help if there is a way to get around this. Thanks.