Ejemplo n.º 1
0
 //fill the order combobox datasource with the data from database by using dbcontext
 private void Form1_Load(object sender, EventArgs e)
 {
     //display orders details and order when formloads from the database.
     using (OrdersDataContext db = new OrdersDataContext()) //connect to db
     {
         orderIDComboBox.DataSource = from ord in db.Orders //fill the combobox i.e datasource with order id's from orders table
                                      orderby ord.OrderID
                                      select ord.OrderID;
     }
 }