TAILIEUCHUNG - DataSets Powerful Objects

DataSets are very powerful objects. You have seen in earlier chapters how they can act as in-memory datastore and how you can use them to update a database. However, this power comes at a price | DataSets are very powerful objects. You have seen in earlier chapters how they can act as in-memory datastore and how you can use them to update a database. However this power comes at a price. A DataSet that contains a large number of rows will itself be very large and can consume considerable resources. If you are using a GridView to simply display data rather than modify it using a DataSet may be too cumbersome a solution. The SqlDataSource control has a property called DataSourceMode which you can set to DataSet the default or DataReader. Specifying a value of DataReader causes the data source to open an DataReader object for retrieving data. A DataReader implements a very efficient mechanism for fetching data as a read-only stream. For more information see the sidebar Firehose Cursors in Chapter 23. However one drawback of using a DataReader is that it does not support paging. Caching Data in a Data Source A DataSet contains a copy of the data it fetches. The longer the DataSet is held the more out-of-date the information it holds can become. How can you make certain that the data a user sees in a Web form is the current data without continually refilling the DataSet If you examine the SqlDataSource control you will find that it has three properties that you can use to help solve this problem EnableCaching. Whenever you display a Web form that contains a SqlDataSource control the SQL SELECT statement specified by that control is executed to populate its DataSet. By default if you use paging to display and the rows displayed are spread over several pages the SQL SELECT statement will be executed whenever you move from one page to another. The SQL SELECT statement will also be executed again if you simply refresh the view of the Web form in the browser. In this way you are always presented with a copy of the data that is up-to-date when the Web form is displayed. However if none of the data actually changes between displaying or refreshing pages you are

TÀI LIỆU LIÊN QUAN
10    127    1
6    150    1
7    127    1
5    125    1
6    127    1
6    115    1
6    122    1
6    174    1
7    122    1
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.