DataTable的一个数据集或所有DataTable的一个数据集? [英] One Dataset for each DataTable or one Dataset for all DataTables?

查看:187
本文介绍了DataTable的一个数据集或所有DataTable的一个数据集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个使用本地数据集的C#应用​​程序。
我有一个DataSet的客户信息和一个DataSet的库存项目。
关于性能和文件大小,建议仅使用一个DataSet与客户信息和有库存的数据表,或者为每个DataTable单独的DataSet?
我打算使用数据放入报表(使用报表查看器)。

解决方案

DataSet 是为了构建一个数据集而构建的。它被构建为允许您创建表之间的关系,提供级联和约束。当您一次使用多个表格时,您应该使用数据集将表组合在一起。如果您不使用多个表格,请删除 DataSet ,只需使用 DataTable



现在,如果你正在尝试到本地的所有数据缓存,那么对于所有的表在一个 DataSet 数据可以在一起相关和操作。那么,如果你正在这些表在一起操作



更新: strong>根据您对意图的评论,所有相关数据都存在于单个 DataSet 中。该报告将需要能够知道哪些行是相关的,以什么方式处理分组等。


I am writing a C# application that uses Local DataSets. I have a DataSet for Customer Information, and a DataSet for Stocked Items. In regards to perfomance, and file size, would it be advisable to use just one DataSet with the Customer Infomation and the Stocked Items DataTables, or separate DataSets for each DataTable? I intend to use data to put into a report (using report viewer).

解决方案

The DataSet is built for, well just that, a set of data. It's built to allow you to create relationships between tables, provide cascading, and constraints. You should use data sets to group tables together when you are working with more than one table at a time. If you're not working with more than one table, get rid of the DataSet and just use a DataTable.

Now, if you're trying to cache all of the data locally, then that would make sense for all the tables to be in one DataSet where the data can be related and operated on together. Well, that is if you're operating on those tables together.

UPDATE: based on your comment about your intentions, it makes sense for all of the related data to exist in a single DataSet. The report is going to need to be able to know what rows are related and in what ways to handle grouping and such.

这篇关于DataTable的一个数据集或所有DataTable的一个数据集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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