Results 1 to 8 of 8

Thread: Get tables name from DataBase [vb]

  1. #1
    ghadeer is offline Net Builder
    Join Date
    Oct 2009
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    Public Function FieldNames(dbPath As String, TableName As _
    String) As Collection
    \'Input:
      \'dbPath: Full Path to an Access Database
      \'TableName: Name of a Table within the
          \'Database
    \'Returns: Collection of the names
    \'of fields in that table
    \'or Nothing if there is an error
    \'Requires: a reference to data access
    \'objects (DAO) in your project
    
    Dim oCol As Collection
    Dim db As DAO.Database
    Dim oTD As DAO.TableDef
    Dim lCount As Long, lCtr As Long
    Dim f As DAO.Field
    On Error GoTo errorhandler
    Set db = workspaces(0).opendatabase(dbPath)
    Set oTD = db.TableDefs(TableName)
    Set oCol = New Collection
    With oTD
        lCount = .Fields.Count
          For lCtr = 0 To lCount - 1
            oCol.Add .Fields(lCtr).Name
        Next
    End With
        db.Close
        Set FieldNames = oCol
        
    Exit Function
    errorhandler:
        On Error Resume Next
        If Not db Is Nothing Then db.Close
        Set FieldNames = Nothing
        Exit Function
    End Function

  2. #2
    Aytac01's Avatar
    Aytac01 is offline Newbie Net Builder
    Join Date
    Feb 2009
    Location
    Webhost Hell!
    Posts
    83
    Thanks
    0
    Thanked 3 Times in 3 Posts

  3. #3
    ghadeer is offline Net Builder
    Join Date
    Oct 2009
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    welcome
    its visual basic
    <div class='quotetop'>QUOTE (L33T @ May 7 2009, 12:01 PM) <{POST_SNAPBACK}></div>
    Good SHare..
    Which VB?[/b]

  4. #4
    Aytac01's Avatar
    Aytac01 is offline Newbie Net Builder
    Join Date
    Feb 2009
    Location
    Webhost Hell!
    Posts
    83
    Thanks
    0
    Thanked 3 Times in 3 Posts
    <div class='quotetop'>QUOTE (ghadeer @ May 7 2009, 01:20 PM) <{POST_SNAPBACK}></div>
    welcome
    its visual basic[/b]
    Yes! I know how to Code in VB pro..
    But the newest version?

  5. #5
    ghadeer is offline Net Builder
    Join Date
    Oct 2009
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you mean .net
    <div class='quotetop'>QUOTE (L33T @ May 7 2009, 01:22 PM) <{POST_SNAPBACK}></div>
    Yes! I know how to Code in VB pro..
    But the newest version?[/b]

  6. #6
    Aytac01's Avatar
    Aytac01 is offline Newbie Net Builder
    Join Date
    Feb 2009
    Location
    Webhost Hell!
    Posts
    83
    Thanks
    0
    Thanked 3 Times in 3 Posts
    <div class='quotetop'>QUOTE (ghadeer @ May 7 2009, 01:29 PM) <{POST_SNAPBACK}></div>
    you mean .net[/b]
    VB.net yes..
    And I know C++, Java and ....

  7. #7
    Eyes's Avatar
    Eyes is offline Newbie Net Builder
    Join Date
    May 2009
    Location
    In a Party
    Posts
    83
    Thanks
    0
    Thanked 1 Time in 1 Post
    yh this is good, but its the long way round, why dont you just creat a connect.php file and do a simple mysql request

    3 lines -> easy

  8. #8
    ghadeer is offline Net Builder
    Join Date
    Oct 2009
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    1- its not php coding (php+mysql) its (visualbasic6ith any database (access, paradox,...))
    2-its not to connect app with database this code to get (tables name from detcated data base)
    <div class='quotetop'>QUOTE (Eyes @ May 8 2009, 09:15 AM) <{POST_SNAPBACK}></div>
    yh this is good, but its the long way round, why dont you just creat a connect.php file and do a simple mysql request

    3 lines -> easy[/b]

Similar Threads

  1. [WTH] Need to add new tables to phpbb install
    By kewler in forum Services
    Replies: 0
    Last Post: 20 March, 2010, 12:00 PM
  2. Inserting new tables in PHPBB setup file
    By kewler in forum Databases
    Replies: 0
    Last Post: 10 March, 2010, 07:45 AM
  3. Problem with tables
    By Brandon Dennis in forum Wordpress
    Replies: 4
    Last Post: 13 February, 2010, 19:44 PM
  4. Database Creator [php]
    By ghadeer in forum Programming
    Replies: 0
    Last Post: 4 May, 2009, 11:07 AM

Tags for this Thread

Bookmarks

Posting Permissions

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