Which one is Faster DATABINDER? DataAdapter-CombinedWith-Dataset or Data Reader?
DataReader is much faster than DataAdapter-Dataset. By the way, DataReader is Readonly as well as forward only.
To further improve the performance, once the DataReader has read the data, off load the data to .... and close the DataReader as well as DataConnection.
If you dont close the DatabaseConnection, then, Mr.DataReader will hold that connection, which leads to scalability problems when the number of users are more. For details about this scalabitity is available here.http://msdn.microsoft.com/en-us/library/ms978388.aspx
The Next Question is : Where this DataReader will offload its data?
There are two places. ARRAYLIST,DATATABLE-CUM-DATAVIEW
I am using the following code for ArrayList: Further details about this code is available here:http://www.developerfusion.com/article/5292/datagridgridview-paging-and-sorting-using-a-datareader/3/
<%@ Page Language="VB" Debug="False" Strict="True"
Explicit="True" Buffer="True" Trace="False"
Sub Page_Load (Source As Object, E As EventArgs)
Private _SupplierID As Object
_SupplierID = SupplierID
Public Property CompanyName() As String
Public Property ContactName() As String
Public Property Country() As String
End Structure 'DBinfo Structure
If Field = ViewState("SortOrder").ToString() Then
'Assign ColumnOrder to ViewState
'Set up Cache Object and determine if it exists
If (dgCache Is Nothing) Then
Dim sqlStr As String = "SELECT SupplierID, CompanyName, "_
Dim MyCommand As New SQLCommand(sqlStr, MyConnection)
'Loop through DataReader
'and then add the instances to the ArrayList
'Insert ArrayList into Cache Object with unique identifier
Sub MyDataGrid_Page(sender As Object, e As DataGridPageChangedEventArgs)
Sub MyDataGrid_Sort(sender As Object, e As DataGridSortCommandEventArgs)
<%= "Page: " & MyDataGrid.CurrentPageIndex+1 & "
of " & (MyDataGrid.PageCount) %>