在线救助,通过bindingsource与页面输入控件进行绑定,保存时如何获取与bingdingsource相关的dataset中的表

lytgmy 2009-04-02 09:43:14
DataEntityTierClassLibrary.NorthwindDataSet northwindDataSet = new DataEntityTierClassLibrary.NorthwindDataSet();
this.customersBindingSource.DataMember = "Customers";
this.customersBindingSource.DataSource = this.northwindDataSet;
this.customerIDTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.customersBindingSource, "CustomerID", true));
点击页面上一个button新增记录时取得Customers这个datatable并且这个表的Customers.Text=customerIDTextBox.Text
...全文
125 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
namhyuk 2009-04-03
  • 打赏
  • 举报
回复

DataView dv = ((DataView)customersBindingSource.List);
NorthwindDataSet.CustomersDataTable dt = (NorthwindDataSet.CustomersDataTable)dv.Table;
namhyuk 2009-04-03
  • 打赏
  • 举报
回复
错了。是: DataView dv = ((DataView)customersBindingSource.List);
namhyuk 2009-04-03
  • 打赏
  • 举报
回复
BindingSource.Current.List转换成Customer表不行吗?

好像没碰winform了~~~
阿非 2009-04-03
  • 打赏
  • 举报
回复

(customerIDTextBox.DataBindings[0].DataSource as DataEntityTierClassLibrary.NorthwindDataSet).Tables["customers"]
lytgmy 2009-04-03
  • 打赏
  • 举报
回复
谢谢各位!
cppfaq 2009-04-02
  • 打赏
  • 举报
回复
customerIDTextBox.DataBindings[0].DataSource
lytgmy 2009-04-02
  • 打赏
  • 举报
回复
customerIDTextBox.DataBindings[0].DataSource,这样获取的是bindingsource,关键如何获取与此bindingsource相关的dataset的customers表对象,谢谢了!

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧