Thursday, March 22, 2012

dataset or datareader?

i need help to know what is the best practice

i have a stored proc which returns 4 different resultselts

will that be easy to use dataset or datareader?

my purpose of using dataset/datareader is to load the data in a class

thanks.

The DataReader is substantially faster than using a DataAdapter to fill a DataSet. Since you are just looking to fill other objects with the read data anyways, the DataReader would definitely be your best bet. Using the DataSet in this context would just be an extra (and unnecessary) step.

|||

Datareder is faster but it also work in connected envorionment. So be sure that if you are development n tier application and want to pass data between tiers and want to access them remotely then it would not work. Then you need to work with data sets. However in general Data Reader is faster.

|||

Datareder is faster but it also work in connected envorionment. So be sure that if you are development n tier application and want to pass data between tiers and want to access them remotely then it would not work. Then you need to work with data sets. However in general Data Reader is faster.

the above underline staement is not correct.,

you can work with datareader if you are developing in n tier application and currently i have n tier env and passing the datareader from daab to web app and i'm closing my datareader in the web_app.

|||

Datareder is faster but it also work in connected envorionment. So be sure that if you are development n tier application and want to pass data between tiers and want to access them remotely then it would not work. Then you need to work with data sets. However in general Data Reader is faster.

the above underline statement is not correct.,

you can work with data-reader if you are developing in n tier application and currently i have n tier env and passing the data-reader from daab to web app and i'm closing my data-reader in the web_app.

|||

nisarkhan:

you can work with data-reader if you are developing in n tier application

Nisarkhhan is correct -- there is no problem doing this. I do it too. All you do is use a DataReader to build some type of collection and pass the collection around. Or you can make the collection a property of a class and pass the class around. I too do this all the time.