Getting the column and table name from an SQLDataReader.

A

Antonio Bruno

Hi,

Is it possible, using the SQLDataReader, to know for each
column, not only the name of the column but also the name
of the corresponding table?

With the GetName method I've only been able to get the
column name. Tried GetSchemaTable, but unfortunatly,
fields like "GetTableName" return empty(?).

For example, if I use a DataReader on the following query:

use northwind
select customers.customerid, orders.customerid from
customers, orders where
orders.customerid=customers.customerid

I would like the be able to
distinguish "customers.customerid"
from "orders.customerid", out of my SQLDataReader results.

I'll also be using DataSets, is the solution ( if any )
equal for both classes?

I'm using .NET 1.0, SQL Server 2000; and the Data Access
Application Block.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top