asp.net| Data | Database in asp.net, reading data from a database can be used in DataReader and DataSet 2 ways,
The difference between the two is as follows:
Reading data using a DataSet object generally requires the following 5 steps:
(1) Establish a database link, you can choose SqlConnection or 01edbConnection.
(2) Save the query in a SqlDataAdapter or OleDbDataAdapter object.
(3) Fills the data into a DataTable in the dataset using the Fill method of the DataAdapter object.
(4) To create a DataView object for the DataTable object to display the data, this step can be omitted.
(5) Bind the DataView or dataset to the server control.
The following 6 steps are generally required to read data using DataReader:
(1) Establish a database link, you can choose SqlConnection or OleDbConnection.
(2) Open the database link using the Connection object's Open method.
(3) Save the query in a SqlCommand or OleDbCommand object.
(4) The ExecuteReader method of the Command object is invoked to read the data into the DataReader object.
(5) The read or get method of the call DataReader reads-pen data so that it does not display.
(6) Call the Close method of the connection object and turn off the data sequence link.