Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

YAAQ -- Reader2table or Dataset("mytable")

Yet Another ADO Question

Ok everyone knows use a datareader for trivial data retrieval and a dataset if you require post query manipulation more complex than forward only reading or updates more complex than ExecuteNonQuery().  I am doing a lot of trivial data retrieval, but occasionally instead of iterating through the datareader to grab values from its items, I need to store the results in a table to "use later."

I wrote a function:

rdr2table(myReader as datareader) as datatable

that  sets up a datatable whose columns match the reader's, loops through the reader to fill the table, then returns the table (not posting the whole func to save space but will if anyone wants).

My question: does the overhead of the function negate the performance gain of using a datareader over a using dataset and just creating the table to begin with?  If it does, I might as well ditch it and go with a dataset.

Of course if this whole idea is just a steaming pile, feel free to beat me with a clue-bat.

Thanks in advance for any advice.

Wednesday, April 14, 2004

I doubt if your function differs that much from Microsoft's own DataAdapter.Fill() (it's .NET code too - why should it be much different?). If you're that bothered, do some perf analysis on it to compare.

Duncan Smart
Thursday, April 15, 2004

Well I wasn't exactly losing sleep over it (plenty of other reasons to do that) so that conclusion sounds good to me! I guess I'll go with whatever is most convenient for me on the fly (do my *own* analysis -- eeww ;-) ).


Thursday, April 15, 2004

*  Recent Topics

*  Fog Creek Home