John said:
Hi
Is it possible to check in .net;
1. If sql server 2008 express is installed on a machine?
2. The name of sql server 2008 express instance or instances?
3. If a particular sql server 2008 express instance contains a specific
database?
Many Thanks
You can do all of this with SMO (or DMO in COM based apps, SMO is a .NET
replacement). Do a google search on SMO and you will see how to check SQL
instances, versions, etc. It has a nice method to iterate through all
instances of SQL on a box.
As for databases, you need to be able to connect with an account with
permissions to ask the question. If not, your questions (statements) will
fall on empty ears, so to speak. If you don't have permissions, you can try
to query the database in question, and if you have those rights, you will
either get an exception (does not exist) or an answer. That is a crude, last
ditch effort, of course.
--
Peace and Grace,
Greg
Twitter: @gbworld
Blog:
http://gregorybeamer.spaces.live.com
************************************************
| Think outside the box! |
************************************************