Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Posts
    10

    Unanswered: Browse through a list of databases on a given server

    Hi,

    I would like to allow the user of my ADO.NET application to browse through a list of the available databases on a given server. INFORMATION_SCHEMA in SQL Server Books Online doesn't describe how to do this. How can I do this?
    TIA,
    Royce

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    149
    SELECT * FROM master..sysdatabases

  3. #3
    Join Date
    Jan 2004
    Location
    Shanghai,China
    Posts
    76

    Arrow ADO can do it

    In VB6,use traditional adodb object.We can get any level schema infomation of sql server by OpenSchema method.
    I pasted VB6 sample codes ,hope it should be helpful to u.

    example:
    Dim cn As New ADODB.Connection
    Dim rs As ADODB.Recordset

    cn.Open "Provider=SQLOLEDB.1;Password="""";Persist Security Info=True;User ID=sa;Data Source=wmcw"
    Set rs = cn.OpenSchema(adSchemaCatalogs)

    Do While Not rs.EOF
    Debug.Print rs.Fields("CATALOG_NAME").Value & vbTab & rs.Fields("DESCRIPTION").Value
    rs.MoveNext
    Loop

Posting Permissions

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