Results 1 to 4 of 4

Thread: Access database Column names

  1. #1

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539

    Access database Column names

    Hey all, is there a way to return all the column names from an access table, i can do it in SQL by using the masters sp_columnnames stored proc, however for this project were using a access database
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    After initializing the connection obj and datast , and oleadapter , do it this way :

    VB Code:
    1. Dim adp As New OleDbDataAdapter
    2.         Dim ds As New DataSet
    3.         adp.Fill(ds, "YourTableName")
    4.  
    5.         Dim ColumnCount = ds.Tables("YourTableName").Columns.Count
    6.  
    7.         For i As Integer = 0 To ColumnCount
    8.             MessageBox.Show(ds.Tables("YourTableName").Columns(i).ToString)
    9.         Next

  3. #3
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    MySql has a command SHOW COLUMNS, but don't think Access has an equivalent.

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    If I'm not wrong , there is another way to get column names by Table Schema .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width