Found this interesting interview question:
You need to display the sales data for your division for the past 5 years in a DataGrid on a Web Form. Performance is very important. What would be the best strategy to use in retrieving the data?
My answer is c) but I am not too sure Can anyone point me to the right answer and explain it to me please Thanks
I'd use paging .
You can also accomplish this using stored procedures .
基本上每当测试提到性能和DataReader和DataSet时,经验法则是DataReader == fast和DataSet == slow。
I'd probably say choice A of the answers provided, but paging is definitely the more correct answer. DataSets are slow and load the whole table while DataReader is really fast, just iterating over the records.
Using a select statement as the datasource is just bad practice and never recommended.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.