Error: Attribute column not found
After creating a feature layer using a QueryDef, identifying features may fail with the following error:
Oracle: "Attribute column not found:[ORA-00904: invalid column name][<name of QueryDef>]"
SQLServer: "Attribute column not found[Microsoft OLE DB Provider for SQL Server: Deferred prepare could not be completed][<name of QueryDef>]"
When the table for the layer is opened, it does not display any rows.
The QueryDef object is not handling wild cards (*) for its SubFields property if there are fully qualified fields in any of the tables (for example AREA).
Solution or Workaround
If using wild cards for the SubFields property in the QueryDef, such as:
.SubFields = "*"
.SubFields = "<table name>.*"
aAnd there is a qualified field name in the table, it is necessary to explicitly list those fields that are to be included in the QueryDef, even if it is all of the fields in the table:
.SubFields = "field1,field2,field3,..."