Display Selected range of records in VB.NET
The DataAdapter plays a crucial role as a connector between a DataSet, which represents an in-memory cache of data, and a data source. It facilitates the retrieval and saving of data between these two entities.
When creating an instance of a DataAdapter, the properties related to reading and writing data are set to their initial values. These properties define how the DataAdapter interacts with the data source and the DataSet.
A DataSet consists of a collection of tables, relationships, and constraints. In the ADO.NET framework, DataTable objects are utilized to represent individual tables within a DataSet. These DataTables store the actual data retrieved from the data source or modified within the application.
One of the key features of a DataSet is its ability to function in a disconnected mode. This means that once the data is retrieved from the data source and stored in the DataSet, the connection to the data source can be closed. The DataSet retains the data in memory and can be manipulated and queried without being directly connected to the data source.
The above code will fill the Dataset starting from 5th row and no of rows 3.
- 5 is the starting row no.
- 3 is no of rows we want to fill.
In certain situations, there may be a need to retrieve only a specific range of rows from the data source. In such cases, the DataAdapter can be configured to fill the DataSet with only the desired range of rows. This selective data retrieval allows for optimized performance and reduces the amount of data transferred between the data source and the application.
The following code snippet demonstrates how to fill a specific range of rows from a DataAdapter into a DataSet:Full Source VB.NET