The information in this article applies to:
SUMMARY
A query against tables having columns with the same name results in a
recordset with duplicate field names. This makes it difficult to identify the
parent table of the fields with the same name.
If the statement "select * from table1, table2" is issued, there will be
two fields in the resulting recordset with the name of "col". ActiveX Data
Objects (ADO) does not rename any columns. To workaround this, alias the
column names as indicated in the following example:
If you do not alias the column names you can use the field property
BASETABLENAME to determine the parent tablename. Note:Dynamic field properties
are not set for forward only read-only cursors.
The following code prints the basetable name:
Getting the information about the BASETABLENAME is an expensive
proposition and many backends do not readily provide this information.
MORE INFORMATIONSteps to Reproduce BehaviorThis sample uses the Northwind database that comes with Microsoft SQL Server 7.0.
If it is preferable not to use aliases then you can use the following code to identify the parent table:
However, obtaining BaseTableName is an expensive operation, is only supported for serverside recordsets, and is not supported by all providers.
Additional query words:
Keywords : kbADO kbADO150 kbADO200 kbDatabase kbGrpVBDB kbGrpMDAC kbDSupport kbADO210sp2 kbMDAC210SP2 |
Last Reviewed: November 10, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |