How to check if the server is available!!

Eteleeb

New member
Joined
Apr 6, 2005
Messages
4
Programming Experience
Beginner
Hi People,

In my application I should connect to SQL Server first. therefore, I would like to know how to check if the SQL Server is availaible or no. in other words, when I click connect to the server button, I should check if the server is available or no.
Please can someone tell me how

Thanks
Eteleeb
 

ritesh_jain1982

Well-known member
Joined
Jan 10, 2005
Messages
53
Programming Experience
1-3
Hi,
Try to open the connection if u get any exception that means ur either ur server does not exist or u don't have permission..........

e.g
try
consql.Open
consql.Close
Catch exc as SqlException
Messagebox.show("server does not exist or u don't have permission")
End try
I hope this will help u..................

Regards,
Ritesh

 

Eteleeb

New member
Joined
Apr 6, 2005
Messages
4
Programming Experience
Beginner
YUP,

I already tried that and it is ok now. Thank you very much for helping me
 
Top Bottom