Selected range of records from database | C#
The DataAdapter plays a crucial role as a connector between a DataSet and a data source, facilitating the retrieval and storage of data. When working with the DataAdapter, it adds or refreshes rows in the DataSet to match those in the data source. This synchronization is achieved using the DataSet name, and a DataTable named "Table" is created if it does not already exist.
In ADO.NET, DataTable objects are utilized to represent tables within a DataSet. The DataSet itself is designed to operate in a disconnected mode, meaning it can hold and manipulate data independently of the data source.
In certain situations, there may be a need to retrieve only a specific range of rows from the data source. In such cases, it is possible to fill the DataSet from the DataAdapter with only the desired range of rows.
The above code will fill the Dataset starting from 5th row and 3 rows.
5 is the starting row no
3 is no of rows we want to fill.Full Source C#
By specifying the starting index and the number of rows to retrieve, the Fill method of the DataAdapter populates the DataSet with only the desired range of rows. The "Table" parameter specifies the name of the DataTable to be created or refreshed within the DataSet. This approach provides flexibility in retrieving data from the data source, allowing for selective retrieval of specific ranges of rows as needed.