BindSource bs = new BindSource;
bs.DataSource = null;
bs.DataSource = myBll.GetDataTable(); //获得数据表txtName.DataBindings.Add("Text", bs, "Name", true);
txtDescription.DataBindings.Add("Text", bs, "Description", true);bs.DataSource = null; //这行会报错:无法绑定到 DataSource 的属性或列 Name。参数名: dataMember
bs.DataSource = myBll.GetDataTable();

解决方案 »

  1.   

    还有喔,当有排序时:
    bs.Sort = null; //如果没有这句,下面这行也会报错
    bs.DataSource = null;我记不清当时加上 bs.DataSource=null 是什么目的了,但只知道当时不加就有问题,现在弄得非去掉这行不可。
      

  2.   

    textBox1.DataBindings.Add("Text", bindingSource1, "", true, DataSourceUpdateMode.OnPropertyChanged);  
    bindingSource1.BindingComplete += new BindingCompleteEventHandler(bindingSource1_BindingComplete);private void bindingSource1_BindingComplete(object sender, BindingCompleteEventArgs e){    
     if (e.BindingCompleteContext == BindingCompleteContext.DataSourceUpdate && e.Exception == null) 
     e.Binding.BindingManagerBase.EndCurrentEdit();
    }
      

  3.   

    你在设置了数据绑定的状态下 又将绑定源设为 null 自然出错啦
    删除 bs.DataSource = null;
    绑定后 bs.ResetBindings(bool); // 如果数据架构改变则 true 否则为 false