C#DataAdapter的数据集,并有多个表 [英] C# DataAdapter and DataSet with multiple table
问题描述
我已经从许多地方,这是可能的,以填补使用DataAdapter多个表数据集读取。它也不会说一个更新调用是否可以更新DataSet中的所有表。
I have read from many places that it is possible to fill a DataSet with multiple tables using a DataAdapter. It also does not say whether a single Update call can update all the tables in the DataSet.
有人可以帮我找出这可怎么办呢?
Can someone help me figure out how this can be done?
好像没有任何(我试过网上查找)关于如何做到这一点,除了一个第二填充前,会更改DataAdapter的SelectCommand中的例子。但我觉得这个方法击败DataAdapter的目的。
It seems like there isn't any ( i tried finding online ) examples on how to do it except for one that changes the SelectCommand on the DataAdapter before the second fill. But I feel this method defeats the purpose of the DataAdapter.
据我推测,可能是一个单一的DataAdapter只能处理单个数据库表,只更新适用于该表。因此,一个多表的数据集需要相应DataAdapters调用它们的更新,才能全面更新数据集。这样的话?
From what I figure, perhaps a single DataAdapter can only handle a single database table and Update only works on that table. Hence a multi-table DataSet will require respective DataAdapters call their Update to fully update the DataSet. Is this the case?
最后,将外键关系和约束上持有一个DataSet(级联删除,级联更新)自动?
Finally, will foreign key relations and contraints hold in a DataSet (cascade delete, cascade update) automatically?
也许一个例子或教程链接可能的帮助。 !非常感谢
Maybe a link to an example or tutorial might help. Many thanks!
推荐答案
可以在这些文章将帮助:
May be these article will help:
- Fill DataSet with multiple Tables and update them with DataAdapter
- C# Dataset with multiple tables - OLEDB
随着官方的文章也非常有用的信息:
Following official articles also very useful information:
- Navigating Multiple Related Tables in an ADO.NET Dataset
- Populating a DataSet from a DataAdapter (ADO.NET)
看填充多个DataAdapters在上面的文章部分数据集。
这篇关于C#DataAdapter的数据集,并有多个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!