Results 1 to 3 of 3

Thread: View tables in open connection

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2004
    Posts
    541

    View tables in open connection

    Hello all,

    Is there a way that I can vew the tables once I have connected to an open connection?
    Code:
    ' create a connection object 
            Dim conn As New AdsConnection(MyConnectionString)
    
                'make the connection to the server 
                conn.Open() 'Once connected I want to see the tables available
    Once I know what tables are here I'll know what to select in my subsequent command object.

    Thanks,

    Strick

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: View tables in open connection

    That will vary from database system to database system. What are you using?
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  3. #3
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Re: View tables in open connection

    ^ true...

    vb Code:
    1. Dim SchemaTable As DataTable = conn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, Nothing})
    2.  
    3.  
    4.  
    5.             Dim int As Integer
    6.  
    7.             For int = 0 To SchemaTable.Rows.Count - 1
    8.  
    9.                 If SchemaTable.Rows(int)!TABLE_TYPE.ToString = "TABLE" Then
    10.  
    11.                     'Add items to list box
    12.  
    13.                     ListBox1.Items.Add(SchemaTable.Rows(int)!TABLE_NAME.ToString())
    14.  
    15.                 End If
    16.  
    17.             Next

    That should get you going : ).

    Justin
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

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