DataAdapter.Fill方法在数据集中特定表 [英] DataAdapter.Fill to specific table in dataset
问题描述
我想利用DataAdapter的,不幸的是坚持直ADO.Net的,所有的例子我看到有一个这样的电话:
I am trying to make use of DataAdapter, unfortunately stuck with straight ADO.Net, and all of the examples I see have a call like this:
dataAdapter.Fill(dataSet, "TableName");
我想以这种方式做了填充,这意味着数据进入一个指定的表,这样我就可以在正常周期管理后的表。
I want to do a fill in that manner, meaning the data goes into a named table, so that I can properly manage the tables later on in the cycle.
不幸的是,似乎所有方法签名不再存在,我挣扎了一下,弄清楚如何正确地命名表中的数据集。是否有一个preferred方法,现在这样做呢?还是说只是MS取消与您的数据集进行交互的这种方法吗?
Unfortunately, it appears that that method signature no longer exists, and I am struggling a bit to figure out how to name the table in the DataSet properly. Is there a preferred method for doing this now? Or did MS just scrap this method of interacting with your DataSet?
推荐答案
怎么这样呢?
DataTable myTable = new DataTable("MyTable");
adapter.Fill(myTable);
ds.Tables.Add(myTable);
还有一件事,你所提到的方法签名确实存在。你可以找到方法参考 此处
。
这篇关于DataAdapter.Fill方法在数据集中特定表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!