1. datagrid.datasourse = yourDataSetName.table[0];   //指定表.

解决方案 »

  1.   

    How can I bind two datagrids in a Master-Detail relationship?
    http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q780q
      

  2.   

    问题一:
    this.sqlDataAdapter1.Fill(this.dataSet1,"Demo");
    this.dataView1=this.dataSet1..Tables["Demo"].DefaultView;
    this.dataView1.AllowEdit = false;
    this.dataView1.AllowDelete = false;
    this.dataView1.AllowNew = false;
    this.dataGrid1.DataSource=dataView1;
    问题二:
    关于第二个问题,可以定义了个
    System.Windows.Forms.BindingManagerBase mybind;
    this.mybind = this.BindingContext[this.dataView1];
    this.mybind.PositionChanged += new EventHandler(mybind_PositionChanged);
    然后再定义了个事件:
    private void mybind_PositionChanged(object sender,System.EventArgs e)
    {
    .....//这里就是你所想要的,在dataGrid2中进行加载数据!
    }希望对你有帮助!
    呵呵……
      

  3.   

    dataGrid.datasourse = 数据源名;
      

  4.   

    1、数据源绑定到DataSet而不是DataTable。2、MSDN演练里有一个主从表的完整的例子。
      

  5.   

    使用两个DataGrid通过DataRelation绑定不同的数据表。
    设置绑定的DataMember就行了
    this.dataGrid1.DataSource = this.ds1;
    this.dataGrid1.DataMember = "table1";this.dataGrid2.DataSource = this.ds1;
    this.dataGrid2.DataMember = "table1.relation12";relation12是两个表之间的关系名。
    楼主要定义他们的关系使用DataRelation对象。