Identify Autonumber field using VB6

From: Amit Dandavate (Dandavate_at_discussions.microsoft.com)
Date: 08/23/04


Date: Mon, 23 Aug 2004 02:03:03 -0700

Hi,

I am reading the database schema information for an access database using
visual basic. I get all the relevant information except the autonumber field.
I have a question as -
How to identify the Autonumber field of Access? similarly
How to identify the Identify field of SQL server?

For populating the database information I am using following code in vb6.

Private Sub PopulateFields(ByVal sTableName As String, ByRef lstList As
ListBox)
    'Function added by Amit
    
    On Error GoTo ErrHandler
    
    Dim rs111 As ADODB.Recordset
    Dim rsarr() As Variant
    Dim iCnt As Integer
    
    s = Array(DataBaseName, Empty, sTableName)
    Set rs111 = db.OpenSchema(adSchemaColumns, s)
            
    If Not rs111.EOF Then
        rs111.MoveFirst
            
        ' Fill array with all Field information for this Table
        rsarr = rs111.GetRows
        iCnt = UBound(rsarr, 2) + 1
        If iCnt >= 1 Then
            For i = 0 To iCnt - 1
                lstList.AddItem Trim(rsarr(3, i) & "") 'table field name
                'Note-Other information can be located in the array.
currently loading only field name and data type id.
                lstList.ItemData(i) = Trim(rsarr(11, i) & "")
            Next
        End If
        
        rs111.Close
        Set rs111 = Nothing
    End If
    
    Exit Sub
ErrHandler:
    MsgBox Err.Number & "-" & Err.Description
End Sub

Please Help me as soon as possible.

Regards,

Amit Dandavate.



Relevant Pages

  • Re: Identify Autonumber field using VB6
    ... I am reading the database schema information for an access database using ... I get all the relevant information except the autonumber field. ... Private Sub PopulateFields(ByVal sTableName As String, ... Dim rs111 As ADODB.Recordset ...
    (microsoft.public.vb.database.ado)
  • Autonumber duplication between tables on the desktop and a PDA
    ... PC running in Windows Mobile 2005. ... The mobile database is built using Visual ... two possible scenarios for specifying separate ranges for Autonumber fields ... data on the desktop device it starts the autonumber field at the next ...
    (microsoft.public.access.tablesdbdesign)
  • Autonumber duplication for referenced tables between desktop and P
    ... PC running in Windows Mobile 2005. ... The mobile database is built using Visual ... two possible scenarios for specifying separate ranges for Autonumber fields ... data on the desktop device it starts the autonumber field at the next ...
    (microsoft.public.access.formscoding)
  • RE: Identify Autonumber field using VB6
    ... Amit, ... > I am reading the database schema information for an access database using ... I get all the relevant information except the autonumber field. ...
    (microsoft.public.data.ado)
  • Identify Autonumber field using VB6
    ... I am reading the database schema information for an access database using ... I get all the relevant information except the autonumber field. ... Dim rs111 As ADODB.Recordset ...
    (microsoft.public.vb.database.ado)