可能使用的数据集为ref [英] Possible to use dataset as ref

查看:226
本文介绍了可能使用的数据集为ref的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用多表格的多个数据集。所以我使数据集公共和存储这对我的MdiParent形式。当我打开任何形式的我用这个调用子窗体的数据集,该数据集绑定我的组合框。有20个数据集的形式使用。因此,由于这个加载时间需要近30 - 35秒。所以我想使用该数据集为 REF 。我怎样才能做到这一点。下面是我使用的是现在的code

i have multiple dataset that is using on multiple form . so i make the dataset as public and store this on my Mdiparent form . when i open any form i use this call the dataset on child form and bind that dataset with my combobox . There are 20 dataset that are using on the form . So due to this load time take near about 30 - 35 seconds . So i want to use that dataset as ref . How can i do this . Below the code that i am using right now

在表格父

  public DataSet dszip = null;
  dszip = _forderdac.GetZipPostal();

在子窗体

 DataSet dszip = dsAddr.Copy();
 cmboboxZip.DataSource = dszip.Tables[0];

感谢您的意见和建议。

Thanks for your comments and advice.

推荐答案

A 数据集引用类型通过性质。 值类型是原始类型,如 INT 布尔等。

A DataSet is a Reference Type by nature. Value Types are primitive types like int, bool, double, long, etc.

数据集并不是越大越好approch传输数据。你可以使用泛型的集合,比如名单,其中,T> ,并创建一个类(的 DTO 对象样本),其中包含只是你需要绑定到的属性形成。有了这个,你可以得到更好的性能。

DataSet is not the better approch to transfer data. You could use generics collections like List<T> and create a class (a DTO object for sample) which contains just the properties you need to bind into the form. With this you can get a better performance.

您可以肯定,如果你的查询伊特诺数据库,填补了这一数据集是很好的查询。

You could be sure if your query itno database to fill this dataSet is good query.

用一些细节这篇文章解释了为什么是更好的使用泛型集合,而不是数据集。 http://msdn.microsoft.com/en-us/magazine/cc163751.aspx

This article explain with some detail why is better using generics collections instead dataset. http://msdn.microsoft.com/en-us/magazine/cc163751.aspx

这篇关于可能使用的数据集为ref的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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