Re: How to I get a list of databases?
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Mon, 23 Jul 2007 15:02:32 -0400
Dave Navarro wrote:
How can I get a list of databases in an SQL server that I have
permissions for?
You can get a list of databases by querying the master.dbo.sysdatabases
table. Depending on the version of SQL Server you are using, there are other
ways as well.
Then, to determine which ones you have permissions for, I guess you would
need to loop through the list of names and attempt to open a connection to
each one in turn, catching the error if it fails.
That's because ADOX is geared to work with a single database at a time: its
I have used ADOX to get a list of tables in a database, but I can't
find any sample ADOX code for getting a list of databases on a server
that I can access.
top-level object is the Catalog, i.e., database.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
.
- Follow-Ups:
- Re: How to I get a list of databases?
- From: Dave Navarro
- Re: How to I get a list of databases?
- References:
- How to I get a list of databases?
- From: Dave Navarro
- How to I get a list of databases?
- Prev by Date: How to I get a list of databases?
- Next by Date: Re: How to I get a list of databases?
- Previous by thread: How to I get a list of databases?
- Next by thread: Re: How to I get a list of databases?
- Index(es):
Relevant Pages
|
|