What are the steps involved to fill a dataset?

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)
How can we check that some changes have been made to dataset since it was loaded?
The changes made to the dataset can be tracked using the GetChanges and HasChanges methods.....
How can we add/remove row’s in “DataTable” object of “DataSet”?
How can we add/remove row’s in “DataTable” object of “DataSet”? - NewRow method is provided by the Datatable to add new row to it.DataTable has DataRowCollection object which has all rows in a DataTable object....
How do we use stored procedure in ADO.NET?
How do we use stored procedure in ADO.NET and how do we provide parameters to the stored procedures?
Post your comment