Click here to Skip to main content
13,507,371 members
Rate this:
Please Sign up or sign in to vote.
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 15-Jan-13 19:19pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You could use WMI to check if a server exists and if you can connect to it -[^].

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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Is the database and the 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[^]


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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180417.1 | Last Updated 16 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100