For accessing the database, for getting the data or inserting the data we basically use SQLDataAdapter.Fill(), ExecuteNonQuery() and ExecuteScalar(), I have seen when I was a fresher, many developers were confused between them and don’t know which one is suitable for which condition.
Basically in C# DataReader is used to retrieve data from database. It is connected architecture. The data is exists as long as the connection with database exists. It can’t persist the data. It fetches the record from the database. It releases the fetch record after query executes and don’t wait for entire query execution. This is why very fast as compare to Dataset.
Pages : 1