What are the steps involved to fill a dataset?
- The DataSet object is a disconnected storage.
- It is used for manipulation of relational data.
- The DataSet is filled with data from the store
- We fill it with data fetched from the data store. Once the work is done with the dataset, connection is reestablished and the changes are reflected back into the store.
What are the steps involved to fill a dataset?
1. Create a connection object.
2. Create an adapter by passing the string query and the connection object as parameters.
3. Create a new object of dataset.
4. Call the Fill method of the adapter and pass the dataset object.
Example : VB.NET Code :Dim strSQL as String
strSQL = "SELECT * from tbl"
Dim sqlCmd As New SqlCommand(strSQL, sqlConn)
Dim sda As New SqlDataAdapter(sqlCmd)
Dim ds As New DataSet
sda.Fill(ds)