Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SqlDataReader or Dataset - which is better?

Status
Not open for further replies.

bigfoot

Programmer
May 4, 1999
1,779
US
Anyone read anything on these 2 objects? I'm looking for info on which to use when.

I have a form that I am calling a query and returning record. Would I use a reader or a dataset?

Stuff like that. Been searching the web, but no luck.
 
Reader: you want to display the data, and aren't really playing around with it.

Dataset: when you need to manipulate the data disconnected from the database.

Readers are forward only from what I understand, where datasets can be manipulated in various ways (they are basically virtual sets of tables).

Hope this clears it up for ya

D'Arcy
 
Thanks. I got that much. What I wanted was, "It's the best pratice to use a datareader when..." kind of thing.

What is faster, has the smallest footprint in memory. I would think the datareader does.

Thanks for the response.
 
Well, if you're just displaying a list of something, then a datareader is probably the best way to go.

i.e. here's alist of clients
client1
client2
client3
etc.

If you need to do something a bit more complex (maybe some databinding), you'd be better off with the dataset
i.e. You want to bind a treeview to some xml that you get by using a datasets writexml method. (I don't believe the reader has any xml methods built in...could be wrong, but I'm pretty sure).

D'Arcy

 
Thanks. I did create a dataset in memory. and load and save to XML. That was really cool. Being an old DOS guy, all this stuff is a BiG improvement over VB 3,4,5, & 6.
 
DOS? whats that? I've heard stories about something called...disk...operating something...?
;)

Yeah, its amazing how much further microsoft has come with development tools.
:)

D
 
I had a friend once who actually knew how the disk opersting system loaded and saved files. FAT tables and all. :)

Somethings in life, you don't wanna know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top