What is the difference between using oledbDataReader and DataAdaptor ?
Which one is best to use ? for fetching data from db...
What is the difference between using oledbDataReader and DataAdaptor ?
Which one is best to use ? for fetching data from db...
You can use ADO.NET either in a generic style (using the interface definitions), which makes it easier to port your app to a new database, or in a DB-specific form.
If you're using SQL Server and don't plan to switch, then it's usually better to stick with the SqlClient classes, such as SqlDataAdapter and SqlDataReader.
To fetch from a DB, the best option depends in part on where you want to put the data after you read it. SqlDataAdapter.Fill() is good for DataSets or DataTables; SqlDataReader is good for custom classes. SqlDataReader is probably a bit faster, but it also does less for you.
I belive there`s some kind of confusion in this question.
DataReader is used for read-only stream of data, while DataAdapters are used to read and write data using DataSets.
Both can be used with OleDB, SQL or Oracle.
There are a long list of disadvantages of using DataSets. Unless you have a specific reason for using DataSets (which go hand in hand with DataAdapters), default to using DataReaders.