how to handle sql with selecting attributes from multiple tables

  • Thread starter Thread starter Jeff Lu
  • Start date Start date
J

Jeff Lu

a sql like: "select t1.a, t2.b from t1, t2 ...",
how does ado.net handle the query result from this kind of sql?

thx.
hongyu
 
your question is unclear. but, for ado.net doesn't look any difference that
result is coming from one table or 10 tables as far as retrieveal is the
only aim.
say, it gives the same result as query analyzer/sql * plus gives, if you
write this query in that tools.

Rajesh Patel
 
if i use DataReader to read the query results, how to get the meta data
of the columns from different tables?

thx.
 
If you are using tables like that, you may want to consider using a
DataRelation and pulling the tables individually, connecting them after
you've grabbed them from the DB. If you are joining tables, you are pulling
over redundant data that eats up bandwidth and depending on size, can really
hinder performance. That's not to say that you should never join tables
server side...but make sure that's really the way you want to do it. From
your later post, you mention the meta data. I'm not sure what platform you
are referring to, or what specific meta data you are referring to, but
DataReader.GetSchemaTable will give you basic information about the fields
pulled over.

What specifically in the MD are you looking for? Let me know and I can
probably be of more help.

Bill
 
suppose there are 2 tables with 1-m relationship,
Order and Transaction(with orderId as the foreign key).
i want to get some Tx columns as well as some Order columns within
a single sql, which can be "select tx.attr1, tx.attr2, o.attr1 from
Transaction tx, Order o where tx.seq=? and tx.orderId=o.orderId".
with the query result from such a query, i can build a entity(let's
say a ReportingEntity) through some O-R mapping mechanism. The O-R
mapping layer needs meta data of the query result to build/bind
the entity. so, for each column/value of the DataReader, i
need to know its DB table name, DB column name and maybe its type.

DataReader.GetSchemaTable returns a DataTable, i didn't see a API
for getting the meta data across multiple tables mentioned above.
i guess i must have missed sth.

thx for your help.
 
Back
Top