Good evening folks how to populate a collection type property using this type of structure in a class:
public class Order
{
public string orderNumber {get; set; }
public DateTime orderDate {get; set; }
private DateTime RequiredDate {get; set; }
private DateTime ShippedDate {get; set; }
public int CustomerNumber {get; set; }
public bool status {get; set; }
public string comments {get; set; }
private IEnumerable OrderDetail;
public virtual IEnumerable OrderDetails
{
get {return OrderDetail; }
set {OrderDetail = value; }
}
public Order ()
{
OrderDetail = new List ();
}
}
In the form's Load event
private void frmlogin_Load(object sender, EventArgs e)
{
try
{
myConnection = new MySqlConnection(myConnString);
myConnection.Open();
MySqlDataAdapter conexaoAdapter =
new MySqlDataAdapter("SELECT O.orderNumber,O.orderDate,O.customerNumber, D.productCode,D.quantityOrdered,D.priceEach " +
"FROM Orders O " +
"INNER JOIN OrderDetails D " +
"ON O.orderNumber = D.orderNumber ", myConnection);
conexaoAdapter.Fill(DataTableDatbase);
Continua .....
How to fill this class property
private IEnumerable<OrderDetail> orderDetail;
Can anyone pass any tips or examples?