R
Rob Richardson
Greetings!
My company makes furnaces to anneal (a form of heat-treating) coils of
steel. Our database contains a table named "inventory" that has every
coil that has ever been annealed since our application was installed.
It is quite likely that I will want to know about a single coil that
is being annealed, and that I will know the coil's ID before I ask the
database about it. If I set up a data adapter with the query "select
* from inventory" and then fill a DataTable from the adapter, I will
get records for all 50,000 coils. Once I have the table, I can create
a DataView object and apply a filter to it to get only the row I care
about, but I'll already have wasted the time to read 49,999 records.
If I want to limit myself to only the coil I'm interested in, I could
change the query to "select * from inventory where coil_id = 'ABCD' ",
but that seems a very clumsy way of doing things. Similarly, if I do
want all of the coil records but I want them sorted, I could just use
the plain query to load the table and then use the view object's Sort
property, but I would think it would be faster to sort them when I
originally read them. Is there a better way to limit or sort my
records at the time they're originally read than building an SQL
statement that will do what I want?
Thanks very much!
RobR
My company makes furnaces to anneal (a form of heat-treating) coils of
steel. Our database contains a table named "inventory" that has every
coil that has ever been annealed since our application was installed.
It is quite likely that I will want to know about a single coil that
is being annealed, and that I will know the coil's ID before I ask the
database about it. If I set up a data adapter with the query "select
* from inventory" and then fill a DataTable from the adapter, I will
get records for all 50,000 coils. Once I have the table, I can create
a DataView object and apply a filter to it to get only the row I care
about, but I'll already have wasted the time to read 49,999 records.
If I want to limit myself to only the coil I'm interested in, I could
change the query to "select * from inventory where coil_id = 'ABCD' ",
but that seems a very clumsy way of doing things. Similarly, if I do
want all of the coil records but I want them sorted, I could just use
the plain query to load the table and then use the view object's Sort
property, but I would think it would be faster to sort them when I
originally read them. Is there a better way to limit or sort my
records at the time they're originally read than building an SQL
statement that will do what I want?
Thanks very much!
RobR