The dataset in Visual Studio.Net represents a localized version of data from the database you are using. You can use the data stored in the dataset, no matter your connection is closed or not.
Let’s see how a dataset can be created. First, up all you need SQL connection, see how to setup connection and adapter.
Build up your query with appropriate columns, then use Fill method of adapter class to fill your dataset as follows.
SqlDataAdapter ProductTableAdapter = new SqlDataAdapter(“select * from productMaster”, con);
DataSet ProductDataset=new DataSet()
ProductTableAdapter.Fill(MDataset, “ProductMaster”);
* Here ‘con’ is the SQL connection object.
Now you are ready to use ProductDataset
One thought on “How to create a SQL dataset in C#”