473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Fastest way to get data?

DataTable loading a SqlDataReader (dt.Load())?
Vanilla DataTable using SqlDataAdapter
or SqlDataReader ?

or is there a better way using Generics? If so, how? Essentially I
want to get about 50-100 rows of data (2 columns) out of my database
and use this is serveral places without caching it as the data could
get updated several times during a period of 5 minutes and thus, needs
to be always up-to-date.
TIA

Dave

Sep 1 '07 #1
3 2044
a native forward only/read only sql data reader should give you the best
performance.

"Code Monkey" wrote:
DataTable loading a SqlDataReader (dt.Load())?
Vanilla DataTable using SqlDataAdapter
or SqlDataReader ?

or is there a better way using Generics? If so, how? Essentially I
want to get about 50-100 rows of data (2 columns) out of my database
and use this is serveral places without caching it as the data could
get updated several times during a period of 5 minutes and thus, needs
to be always up-to-date.
TIA

Dave

Sep 1 '07 #2
DataReader is certainly the "fastest" way to get the data, but you also have
to consider what you are doing with it. If you are holding on to the data
over a period of time with only a DataReader to firehose over, you are
holding a connection open.
Loading into a DataTable may add a couple of milliseconds to the operation
but you can close the connection and allow it to return to the pool, and now
you have your data in a disconnected manner until the next time you need to
get it.
In the big scheme of things, with only 50 to 100 rows, we are talking mere
miliseconds here.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Code Monkey" wrote:
DataTable loading a SqlDataReader (dt.Load())?
Vanilla DataTable using SqlDataAdapter
or SqlDataReader ?

or is there a better way using Generics? If so, how? Essentially I
want to get about 50-100 rows of data (2 columns) out of my database
and use this is serveral places without caching it as the data could
get updated several times during a period of 5 minutes and thus, needs
to be always up-to-date.
TIA

Dave

Sep 1 '07 #3
Thought it might be - but there's no harm in asking. Most of my work
involves DataTables anyway.

Thanks.

Sep 2 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Rune Strand | last post by:
Hi, If I have a lot of integers and want do something with each digit as integer, what is the fastest way to get there? Eg. Make 12345 into an iterable object, like or "12345" (Btw: What is...
6
by: Neal D. Becker | last post by:
I need a fairly small lookup table, and I'm wondering which data python data structure would be fastest. I could use a list, tuple, dictionary, numeric array, or maybe plain python array. The...
11
by: DraguVaso | last post by:
Hi, I should use XML to synchronize the data from different (VB.NET) applications, and I was just wondering which Overloads of these functions ( ReadXmlSchema, ReadXml and WriteXml) goes the...
2
by: yee young han | last post by:
I need a fast data structure and algorithm like below condition. (1) this data structure contain only 10,000 data entry. (2) data structure's one entry is like below typedef struct _DataEntry_...
60
by: Julie | last post by:
What is the *fastest* way in .NET to search large on-disk text files (100+ MB) for a given string. The files are unindexed and unsorted, and for the purposes of my immediate requirements, can't...
11
by: hoopsho | last post by:
Hi Everyone, I am trying to write a program that does a few things very fast and with efficient use of memory... a) I need to parse a space-delimited file that is really large, upwards fo a...
3
by: Harry Haller | last post by:
What is the fastest way to search a client-side database? I have about 60-65 kb of data downloaded to the client which is present in 3 dynamically created list boxes. The boxes are filled from 3...
1
by: Harry Haller | last post by:
What is the fastest way to search a client-side database? I have about 60-65 kb of data downloaded to the client which is present in 3 dynamically created list boxes. The boxes are filled from 3...
22
by: SETT Programming Contest | last post by:
The SETT Programming Contest: The fastest set<Timplementation Write the fastest set<Timplementation using only standard C++/C. Ideally it should have the same interface like std::set. At least...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.