我们可以在没有数据适配器对象的情况下填充数据集吗 [英] can we fill the dataset without data adapter object

查看:85
本文介绍了我们可以在没有数据适配器对象的情况下填充数据集吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在没有数据适配器的情况下是否有可能在数据集中存储表值

is there any posibility of storing table values in the dataset without data adapter

推荐答案

是的,您可以手动创建DataSet并根据需要添加DataTables

Yes, you can create a DataSet manually and add DataTables as necessary

DataSet ds = new DataSet("myDS");
DataTable dt1 = ds.Tables.Add("Table1");
DataTable dt2 = ds.Tables.Add("Table2");

// assume columns have been created
dt1.Rows.Add(...);
dt2.Rows.Add(...);


是的,创建一个SqlDataReader并将其转换为Dataset,点击链接以了解更多信息

转换为数据集:
http://osherove.com/blog/2004/1/22/convert-a-datareader-into-a-dataset.html [ http://www.dotnetcurry.com/ShowArticle.aspx?ID=143 [ ^ ]
Yes, create a SqlDataReader and convert it to Dataset, follow the link to learn more

convert to dataset:
http://osherove.com/blog/2004/1/22/convert-a-datareader-into-a-dataset.html[^]

convert to datatable:
:)http://www.dotnetcurry.com/ShowArticle.aspx?ID=143[^]


是的,您可以使用DataReader并手动填充数据集.这就是DataAdapter在后台进行的操作.
Yes you can use the DataReader and fill a dataset manually. That''s what the DataAdapter is doing under the covers.


这篇关于我们可以在没有数据适配器对象的情况下填充数据集吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆