How to check if the server is available!!
Hi People
In my application I should connecto to SQL Server first. therefore, I would like to know how to check if the SQL Server is online or no. in other words, when I click connecto to the server button I should check if the server is available or no.
Please can someone tell me how
Thanks
Eteleeb
Re: How to check if the server is available!!
Quote:
Originally Posted by Eteleeb
Hi People
In my application I should connecto to SQL Server first. therefore, I would like to know how to check if the SQL Server is online or no. in other words, when I click connecto to the server button I should check if the server is available or no.
Please can someone tell me how
Thanks
Eteleeb
If you are using VB6 then use On Error Go to Error handler to catch error, if .net then use Try Catch to catch any error and if any error occurs that means Server is not available.
Re: How to check if the server is available!!
Yes that's true but what I want to do is making connection only to the server without mentioning the database name or the uid or password in my connection string. can you please tell how the connection string will look like?
Re: How to check if the server is available!!
Eteleeb,
You are asking for two seperate issues. Connecting to a database is not the same as connecting to a server. The database may be on a server, but so may other apps. There is no connection string to connect to a server, only to a database.
You can see if a server is up by pinging it (if allowed) or by checking an app or file on it (which in essense is a connection).
Re: How to check if the server is available!!
Thank you guys for explainig things. now it is clear and I got it.
I really appreciate that