コード例 #1
0
        private void GetOrderBindResults(int orderID)
        {
            // Get the SalesOrderHeader and related SalesOrderDetails object for the order
            // with the specified SalesOrderID value, overwriting local changes with
            // values from the database.
            ObjectQuery <SalesOrderHeader> orderQuery =
                objCtx.SalesOrderHeader.Include("SalesOrderDetail")
                .Where("it.SalesOrderID == @p", new ObjectParameter("p", orderID));

            orderQuery.MergeOption = MergeOption.OverwriteChanges;

            // Bind the SalesOrderHeader binding source to execution of the first returned object.
            bindingSourceOrders.DataSource = orderQuery.First();

            // Set the current order to the bound object.
            currentOrder = (SalesOrderHeader)bindingSourceOrders.Current;

            this.Refresh();
        }