Results 1 to 8 of 8

Thread: Well it sounds simple enough

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446

    Well it sounds simple enough

    Does anyone know of any ADO or SQL to list the table name contents of a database?

    Regards Gary
    "Life isn't about finding yourself. Life is about creating yourself."
    --George Bernard Shaw

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    You want to use the OpenSchema method of a Connection object. I haven't used it, so I don't have an example, but this is from MSDN:
    The OpenSchema method returns self-descriptive information about the data source, such as what tables are in the data source, the columns in the tables, and the data types supported.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446
    Have an example line of code Jo
    "Life isn't about finding yourself. Life is about creating yourself."
    --George Bernard Shaw

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446
    Someone sent me this "select * from sysobjects" shed any light.??
    "Life isn't about finding yourself. Life is about creating yourself."
    --George Bernard Shaw

  5. #5
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    http://msdn.microsoft.com/library/de...openschema.asp

    There's a link to VB sample code at the end of the page.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446
    Read through that, it dont work. ASP Pages these are. If theres no SQL statement to do it, how can anything else?
    "Life isn't about finding yourself. Life is about creating yourself."
    --George Bernard Shaw

  7. #7
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    This code worked beautifully for me. Just convert it to ASP and you're set. You don't need SQL statements to get data out of a database, they're just one way of doing it.

    VB Code:
    1. Dim c As ADODB.Connection
    2.     Dim rs As ADODB.Recordset
    3.    
    4.     Set c = New ADODB.Connection
    5.     c.Open "Provider=SQLOLEDB;Server=SQLServer2000;Database=MyDatabase;Trusted_Connection=Yes;"
    6.     Set rs = c.OpenSchema(adSchemaTables)
    7.    
    8.     Do While Not rs.EOF
    9.         Debug.Print rs.Fields("TABLE_NAME")
    10.         rs.MoveNext
    11.     Loop
    12.    
    13.     rs.Close
    14.     Set rs = Nothing
    15.     c.Close
    16.     Set c = Nothing
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446
    Tried that.... found an example... thanks anyhow.

    http://www.4guysfromrolla.com/webtech/101799-1.shtml
    "Life isn't about finding yourself. Life is about creating yourself."
    --George Bernard Shaw

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