什么是b / w数据集和数据表的差异 [英] What is difference b/w dataset and datatable pratacally
问题描述
实际上我在ado.net中使用断开连接的架构从数据库访问数据
一些代码如
Actually i had access the data from database using disconnected architecture in ado.net
some code like as
Dataset ds=new Dataset();
da.fill(ds)
我们可以写上面的代码与下面相同但有些不同(概念是独一无二的)
we can write above code same as below but some difference there(concept is unique)
DataTable dt=new DataTable();
da.fill(dt)
i想要差异b / w数据集和数据表在这个例子中.both概念将起作用
i对数据集和数据表有疑问,但你可以使用这些不同的
数据类不同的情况
为什么开发人员更喜欢断开模式下的替代类(数据表)
将如何工作?数据集和数据表如何工作。
请帮帮我。
谢谢你
我尝试过:
i想要差异b / w数据集和数据表example.both概念将起作用
i对数据集和数据表有疑问,但你可以使用这些不同的
不同情况下的数据类
为什么开发人员更喜欢断开模式下的替代类(数据表)
怎么会有效?数据集和数据表将如何工作。
i want difference b/w dataset and datatable in this example.both concepts will work
i have doubt about dataset and datatable but you can use the these different
dataclasses in different situations
why should developers prefer the alternative class(datatable) in disconnected mode
how will works ? how the dataset and datatable will work.
please help me.
thank u
What I have tried:
i want difference b/w dataset and datatable in this example.both concepts will work
i have doubt about dataset and datatable but you can use the these different
dataclasses in different situations
why should developers prefer the alternative class(datatable) in disconnected mode
how will works ? how the dataset and datatable will work.
推荐答案
简单来说,DataSet是DataTable对象及其关系(DataRelation)的集合。
DataTables是记录集合,几乎可以反映数据库中表格的概念。
In simplest terms, a DataSet is a collection of DataTable objects and their relationships (DataRelation).
DataTables are collections of records, pretty much mirorring the concept of a table in a database.
我希望在这个例子中有不同的黑白数据集和数据表。两个概念都可以工作
i want difference b/w dataset and datatable in this example.both concepts will work
如果你的查询
或存储过程
返回单个表然后你将去 DataTable
If your Query
or Stored procedure
is returning a single table then you shall go for DataTable
da.fill(dt) // da - dataadapter , dt - datatable
如果它返回多个表,则使用 DataSet
If it returns multiple tables then use DataSet
da.fill(ds) // da- dataadapter, ds - dataset
将分配从查询/过程
返回的表的数量动态地在DataSet中的Number to DataTables,你可以使用表的索引访问DataTable,如$ / b $ b
the number of table returned from the query/procedure
will be assigned to the Number to DataTables inside the DataSet dynamically, which you can access the DataTable using the index of the table, as
var table1 = ds.Tables[0]; // 1st Table
var table2 = ds.Tables[1]; // 2nd Table
有关理论部分的更多信息,请参阅 DataSet与DataTable [ ^ ]
您必须知道您是否使用类型化日期集和数据适配器,日期表是dateset对象的一部分。
You have to know if you are working with typed dateset and data adapter, datetable is a part of dateset object.
这篇关于什么是b / w数据集和数据表的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!