asp.net gridview的数据源 [英] Datasource for asp.net gridview

查看:75
本文介绍了asp.net gridview的数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在aspx页面中有2个gridview.我已经使用SqlDataSource用于一个gried视图,并使用了datatable用于另一个网格视图.对于数据表,我已经在C#中的.cs页中编写了代码.我的要求是哪一个更快?为什么?

在此先感谢.

Suppose i have 2 gridview in aspx page. i have use SqlDataSource for one gried view and datatable for another grid view. for datatable i have written the code in .cs page in c#. My quistion is which one is faster and why??

Thanks in advance.

推荐答案

不可能说:有太多因素.
到SQL Server的网络速度,数据库的大小,数据库的组织,选择命令的复杂性,记录数,DataTable的加载方法等,等等.

如果您想知道,那么您所能做的就是为您的本地实例进行度量:请参阅秒表类 [ ^ ]
Impossible to say: there are too many factors.
Network speed to SQL server, size of DB, organisation of DB, Select command complexity, number of records, load method for DataTable, etc., etc.

If you want to know, then all you can do is measure it for your local instance: see the Stopwatch class[^]


在SqlDataSource中,用于从数据库返回数据的默认对象是DataSet.因此不会有明显的性能差异.
In SqlDataSource the default object used to return data from the database is DataSet. So there will not be a significant performance difference.


这篇关于asp.net gridview的数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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