DataReader ignores table prefix in query? RRS feed

  • Question

  • If you select data from multiple tables using a join, you sometimes have to use a prefix for the column names, like this:

    SELECT Product.Name, Manufacturer.Name FROM Products INNER JOIN Manufacturers ...

    I tried to read the values from the DataReader but it stores both columns under "Name", instead of "Product.Name" and "Manufacturer.Name" as I would have expected.

    What is the reason for this behavior and is there anything I can do about it. Right now I explicitly give the column an alias un the query using 'AS', but I'd rather not.

    Thank you!
    Wednesday, November 21, 2007 1:23 PM