B
Bill
This may be a simple problem ( let's hope ). I am trying to extract
a
filtered set of records from a Sql Server Database. The set of rows,
however, is to be filtered based on data external to the database.
Specifically, this is an Excel Add-in.
The user selects a range which contains order numbers ( single
column ). Loading that data into a DataTable or Array is easy
enough.
Using those ( say 30 ) order_id values, I then want to get data
specific to the order from the order table on a Sql Server Database
( assume 1:1
relationship ).
I am new to ADO, I do not know how best to represent this data
( which
objects ) within the code.
If I use a DataSet where the short list of order ids is in one
DataTable with another table connected to the Sql Server order table,
will I end up loading all 300K of the orders before I get a chance to
filter the set.
Is there an easier way to select the data from the database using
different design options?
Ultimately it breaks down to a query like this:
Can I somehow relate data located only in memory/.Net Objects to a
table within the database?
The query could be written as below but the possibility is that the
list of orders could be as much as 10K.
SELECT a, b, c FROM orders WHERE order_id IN ( 100, 200, 300, ...,
999 )
Is there a way to do this without building that query?
a
filtered set of records from a Sql Server Database. The set of rows,
however, is to be filtered based on data external to the database.
Specifically, this is an Excel Add-in.
The user selects a range which contains order numbers ( single
column ). Loading that data into a DataTable or Array is easy
enough.
Using those ( say 30 ) order_id values, I then want to get data
specific to the order from the order table on a Sql Server Database
( assume 1:1
relationship ).
I am new to ADO, I do not know how best to represent this data
( which
objects ) within the code.
If I use a DataSet where the short list of order ids is in one
DataTable with another table connected to the Sql Server order table,
will I end up loading all 300K of the orders before I get a chance to
filter the set.
Is there an easier way to select the data from the database using
different design options?
Ultimately it breaks down to a query like this:
Can I somehow relate data located only in memory/.Net Objects to a
table within the database?
The query could be written as below but the possibility is that the
list of orders could be as much as 10K.
SELECT a, b, c FROM orders WHERE order_id IN ( 100, 200, 300, ...,
999 )
Is there a way to do this without building that query?