导航

测试日志

Posted on 2010-07-14 22:20  nowell  阅读(141)  评论(0)    收藏  举报
private void getCustomerOrders_Click(object sender, RoutedEventArgs e)
        {
            // Instantiate the data service context and clear any existing bindings.
            ResetBindingData();
            // Define the filter condition based on the customer ID.
            string filterExpression = "CustomerID eq'" + this.customerId.Text + "'";
            // Define a query to return the specifed customer and related orders.
            //根据查询条件先查询Customers表的信息,然后在查询与之关联的Orders表
            DataServiceQuery<Customers> query = svsContext.Customers.AddQueryOption("$filter", filterExpression).Expand("Orders");
            try
            {
                // Begin the query execution.
                query.BeginExecute(OnCustomerOrdersQueryComplete, query);
            }
            catch (Exception ex)
            {
                messageTextBlock.Text = ex.Message;
            }
        }
友荐云推荐