CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2001
    Posts
    31

    list all databases from a selected server

    hi..

    Anybody know how can i list all my databases from "x" server?...
    I already list the servers.. but now i have to fill my combo.. with the databases...

    so.. any help????

    thanks....




  2. #2
    Join Date
    Aug 2001
    Location
    MD
    Posts
    5

    Re: list all databases from a selected server

    Is it a SQL Server database?



  3. #3
    Join Date
    Aug 2001
    Posts
    31

    Re: list all databases from a selected server

    that´s right... thats a sql server..

    and i use trusted and no trusted connections

    .. do u know a way to do this?


  4. #4
    Join Date
    Aug 2001
    Location
    MD
    Posts
    5

    Re: list all databases from a selected server

    Each SQL Server has a table called 'sysdatabases' that is located in the 'master' database. This table keeps track of all databases in that particular server.. How to do this?

    Connect to the master database using ADO or whatever you're using.. use the following SQL statement
    "SELECT name FROM sysdatabases ORDER BY name"

    That should do it..


  5. #5
    Join Date
    Aug 2001
    Posts
    31

    Re: list all databases from a selected server

    hi..

    but if i use this.. i need to open the connection... do i????



  6. #6
    Join Date
    Aug 2001
    Location
    MD
    Posts
    5

    Re: list all databases from a selected server

    Yes.. You open the connection to that SQL server and you connect to the master database


  7. #7
    Join Date
    May 2001
    Location
    Canada
    Posts
    182

    Re: list all databases from a selected server

    For Sql server, you can try 'sp_databases'.

    Regards,

    Michi

  8. #8
    Join Date
    Aug 2001
    Posts
    31

    Re: list all databases from a selected server

    but i cant open the connection yet...

    cause i need to fill my combo and then i can choose my server and then i can choose the databases from that server.. and then i can open the connection using trusted or not trusted..

    do u know waht i mean??

    it´s a form for login...




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

Featured