I have a query in understanding the SQLDataAdapter fill method,which takes arguments like startRecord,MaxRecord as shown below –
SqlDataAdapter adap = new SqlDataAdapter ("Select * from tblname",ConnectionString);
DataSet ds = new DataSet();
adap.Fill(ds, startIndex, MaxRecords , "TableName");
I want to know what will the SqlDataAdapter do.
Will it first fire the query that would bring back entire record from the table and then filer the rows from it ?
or
Will it fire a query in the database that would select only the required amount of rows ?
sqlDataAdapter.Fill(dataSet, currentIndex, pageSize, "TableName");will query for the whole result set and then page them in memory.For large result sets this is not what you want. If you want the paging to happen on the server use the SKIP and TOP clause in the SQL you use.
Here is the documentation which explains this.