private void Form10_2_Load(object sender, EventArgs e)
        {    
            DataSet ds = new DataSet();
            ds.Merge(this.dsOrder().Tables[0]);
            ds.Tables[0].TableName="order";
            ds.Merge(this.dsOrder_list().Tables[0]);
            ds.Tables[1].TableName="order_list";

            DataColumn parentCol;
            DataColumn childCol;
            parentCol = ds.Tables["order"].Columns["编号"];
            childCol = ds.Tables["order_list"].Columns["订单号"];
            DataRelation relOrder;
            relOrder = new DataRelation("OrderList", parentCol, childCol);
            ds.Relations.Add(relOrder);
            this.dgOrder.DataSource = ds;        
            this.dgOrder.DataMember ="order";
            this.dgOrder.CaptionText = "订单";
            this.dgOrder.AllowNavigation = false;
            this.dgOrderList.DataSource = ds;
            this.dgOrderList.DataMember = "order.OrderList";
            this.dgOrderList.CaptionText = "订单明细";
                    }

 

 

 

 

posted on 2006-07-20 11:57  阿米  阅读(1220)  评论(1编辑  收藏  举报