Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2003
    Posts
    4

    Unanswered: get db tables names and their columns

    Basically I want to have a treeview and a listview populated by tables that belong to the database that the user is currently browsing. It's some sort of primitive sybase central, or sql central.
    Do you have any ideas on how to do this???
    Oh, I'm trying to do this in vb or powerbuilder. Any other suggestions on other visual languages are also welcome!
    Please help....

  2. #2
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138
    Haven't work much with listview and treeview, but the sql statement to return all tables in the database is:

    Note: This is for SQL Server
    SELECT * FROM sysobjects WHERE type = 'U'

  3. #3
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251
    you can get tables and columns for almost any data source using ADOX

    you can find list of many connection strings here http://www.able-consulting.com/ADO_Conn.htm


    VB sample and MS Access Data Source

    Sub ShowColumns()

    Dim myAdoX As Object
    Dim i As Integer
    Dim j As Integer
    Dim myConnection As String

    Set myAdoX = CreateObject("ADOX.Catalog")
    myConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=c:\winnt\desktop\db1.mdb;" & _
    "User Id=admin;" & _
    "Password="

    myAdoX.ActiveConnection = myConnection

    For i = 0 To myAdoX.Tables.Count - 1
    Debug.Print myAdoX.Tables(i).Name
    For j = 0 To myAdoX.Tables(i).Columns.Count - 1
    Debug.Print " - " & myAdoX.Tables(i).Columns(j).Name
    Next
    Next

    End Sub


    jiri

  4. #4
    Join Date
    Jan 2003
    Posts
    4
    Let´s say I use ADOX, after deploying my project must ADOX be installed on the compueter I plan to test my executable?

    It seems to be a pretty easy solution, just for curiosity, is there another way without using ADO or ADOX??

    Thanks for the advice!

  5. #5
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251
    you can use what Memnoch1207 recommends. If you plan to use just sybase as a backend, it will work just fine.....

    on the other side, I haven't seen so many PCs without ADOx 2.1 - ADO is part of MS Office2000 and part of Win2k and WinXP. You can download it for free from www.microsoft.com/data and easily deploy on PCs..... setup.exe has some hidden switches....

    jiri


    you can use very old DAO - it has TABLEDEFS collection ......
    or you can play with pure ODBC... http://msdn.microsoft.com/library/de...ns_in_odbc.asp

Posting Permissions

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