Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,
i use windows server 2008r2, visual studio 2010 and sql server management studio.
i need to create a form in which user should enter database server name and on click of a button 'check' it should check my local system for that database server and if found it should redirect to next page or else if not found show messagebox with messgae "database server not found". if the entered database server is found it should open next form and on the next form it should ask for entering username and password to connect to that server.

how do i do it?
pls help me out with this issue.Any help will be appretiated.
Thanks in advance
Posted

You could use WMI to check if a server exists and if you can connect to it - http://support.microsoft.com/kb/q287737[^].

Another approach could be to try and connect to each listed server and see if you get a positive response.
A simple ping would tell you if the server actually exists.
 
Share this answer
 
Is the database and the asp.net application is hosted on the same location or they are on different servers????

If they are on same location then you can use the SQLConnection to check whether the database server exists or not.

You can go to the link below to understand it more better

http://www.dotnetperls.com/sqlconnection[^]

:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900