Re: Recognizing if SQL Server is installed (and what version)
- From: Theo Verweij <tverweij@xxxxxxxxx>
- Date: Fri, 20 Oct 2006 16:20:46 +0200
Agreed.
You only use these constructions when needed.
It is better to avoid exceptions where possible, by doing the proper checks before executing the statements. But there will always be exceptions in a program that must be handled.
The problem I detect in the question of Rick, is that he is using the word "Error trapping", instead of exception handling; an exception is not always an error.
The problem with another way of SQL Server checking(like the registry way provided in the reply of HKSHK) is that the registry entries are changing when new versions of SQL Server are released; SQL 2000 version is stored in Microsoft SQL Server\80, SQL 2005 in Microsoft SQL Server\90, SQL 7 in Microsoft SQL Server\70, SQL 6.5 - I don't know. And maybe the next version will use a complete other path, or even no registry settings at all. Another problem is that you may know that it is installed, and what version it is, but if you don't know if it is running (or if the user has the right to connect to it) you still have to apply a try catch block to a connection to this instance.
rowe_newsgroups wrote:
The only reason is to avoid them is because try catch statements can.
add a lot of overhead if used excessively.
Thanks,
Seth Rowe
Theo Verweij wrote:I never understand the questions where the "programmer" doesn't want to
use exception handling. I always wander what such applications look like
(and how they work) ....
rowe_newsgroups wrote:This is probably the only "prpper" way to do this. Unfortunately, the
OP said he didn't want to do any error trapping (which I assumed meant
he didn't want to try to connect to the server) - but I say "to bad!"
:-)
Thanks,
Seth Rowe
Theo Verweij wrote:Try to connect with a sqlconnection to (local) using integrated security
If it fails to connect, it is not installed, or the current user has no
rights to connect (check error).
If it is connected, you can read the version from the ServerVersion
property.
Rico wrote:Hello,
I have an application which I'd like to determine if SQL Server is
installed, and if so, what version. Is there any way to do this outside of
error trapping?
Thanks!
Rick
- References:
- Recognizing if SQL Server is installed (and what version)
- From: Rico
- Re: Recognizing if SQL Server is installed (and what version)
- From: Theo Verweij
- Re: Recognizing if SQL Server is installed (and what version)
- From: rowe_newsgroups
- Re: Recognizing if SQL Server is installed (and what version)
- From: Theo Verweij
- Re: Recognizing if SQL Server is installed (and what version)
- From: rowe_newsgroups
- Recognizing if SQL Server is installed (and what version)
- Prev by Date: Perform ARP request via code
- Next by Date: Re: Building my own "SMTP" mail - control ?
- Previous by thread: Re: Recognizing if SQL Server is installed (and what version)
- Next by thread: Re: Recognizing if SQL Server is installed (and what version)
- Index(es):
Relevant Pages
|