PRB: ADO's Field ATTRIBUTE Property and adFldRowID

Last reviewed: March 12, 1998
Article ID: Q182351
The information in this article applies to:
  • ActiveX Data Objects (ADO), version 1.5

SYMPTOMS

ADO's field Attribute property will not return "adFldRowID" when checked against any data sources being accessed via the OLEDB Provider for ODBC.

CAUSE

The OLEDB Provider for ODBC, which is used by default, cannot access this information because it is not available through ODBC.

RESOLUTION

Use a native OLEDB Provider specific to the data source being used. The data source must also support a field type that maps to OLE DB's definition of a row identifier to be able to return a value of "adFldRowID".

STATUS

This behavior is by design.

MORE INFORMATION

The "adFldRowID" Attribute maps to OLEDB's DBCOLUMNFLAGS_ISROWID flag. A row that has this flag "contains a persistent row identifier that cannot be written to and has no meaningful value except to identify the row".

Using the description above, no column in SQL Server falls into this category. Thus, even when using a native OLEDB Provider for SQL Server, the "adFldRowID" would not be returned via the field's Attribute property.

Steps to Reproduce Behavior

  1. Start Visual Basic.

  2. Add a Reference to the "Microsoft ActiveX Data Objects 1.5 Library".

  3. Add a command button to the form and add the following code to it's Click method:

          Private Sub Command2_Click()
    
             Dim Cn As New Connection
             Dim rs As New Recordset
             Dim SQL As String
    
             Cn.Open "DRIVER={SQL Server};SERVER=<server_name>;UID=;PWD=;"
             SQL = "select * from pubs..jobs"
             rs.Open SQL, Cn
             MsgBox "Name: " & rs.Fields(0).Name & vbCrLf & "Attribs: " & _
                rs.Fields(0).Attributes
    
             rs.Close
             Cn.Close
          End Sub
    
    

REFERENCES

For more information, refer to the SDK documentation.

Keywords          : adoall
Version           : WINDOWS:1.5
Platform          : WINDOWS
Issue type        : kbprb


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 12, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.