SqlDataAdapter的fill()方法的缓慢行为 [英] slow behavior of fill() method of SqlDataAdapter

查看:1011
本文介绍了SqlDataAdapter的fill()方法的缓慢行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用sqldataadapter的fill()方法填充数据集。 select查询调用其中的用户定义函数。我的问题是,当我在sqlDataAdapter中运行此查询时,fill()方法大约需要70秒。提供输出,但如果我在企业管理器或查询分析器中运行相同的查询,它会在1或2秒内提供输出。我不知道问题出在哪里,如果有人知道这个问题,请帮帮我。

推荐答案

你要加载多少数据?

1. 如果您有大量数据,DataSet不是一个好的选择。 最好使用SqlDataReader,它可以让您更好地控制数据的处理方式。

2. 当您使用Fill时,它必须等到所有数据都回来。 企业管理器能够在数据开始恢复后立即显示。 在它显示部分结果之前,它不必等待它。 再一次,请参阅SqlDataReader以便为您的应用程序进行此类处理。
How much data are you loading?

1.  DataSet is not a good choice if you have a large amount of data.  It is better to use SqlDataReader which lets you take more control over how the data is processed.

2.  When you use Fill, it must wait until all the data has come back.  Enterprise Manager is able to show the data as soon as it starts to come back.  It does not have to wait for it all before it shows you partial results.  Once again, see SqlDataReader to get this kind of processing for your application too.


这篇关于SqlDataAdapter的fill()方法的缓慢行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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