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