开发者

Should I use dataset or datatable?

开发者 https://www.devze.com 2023-01-31 14:40 出处:网络
If I need to fetch one whole column from Table1 in the DB, should I fetch it using datatable or dataset? I can do both ways. I mean ok I should use Datatable. Why is that? What would happen if I use D

If I need to fetch one whole column from Table1 in the DB, should I fetch it using datatable or dataset? I can do both ways. I mean ok I should use Datatable. Why is that? What would happen if I use Dataset?

ok that's what I wanted to know. So there's memory issue. Now I am confused. I mean whatever I use be it Datatable or Dataset, both will be fetching only ONE c开发者_高级运维olumn frommy table in DB. How is Dateset's gonna use more memory then?


Use a DataTable.

A DataSet is an in-memory database while DataTable is an in-memory table.

DataSets are more complicated and heavier-weight; they can contain multiple DataTables and relations between DataTables.


you can better use DataTable(uses less memory).

or you can try with user created value objects or DTO


To answer your edited question, there's more overhead to a dataset. DataTables are better for what you need. If you're doing a lot of data fetching, though, it's easier (and way more maintainable!) to use an ORM of sorts.

0

精彩评论

暂无评论...
验证码 换一张
取 消