Click here to Skip to main content
12,350,143 members (27,069 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET SQL Visual-Studio , +
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 15-Jan-13 19:19pm
Rate this: bad
 
good
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 - 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.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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[^]

Smile | :)
  Permalink  

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 | Mobile
Web02 | 2.8.160621.1 | Last Updated 16 Jan 2013
Copyright © CodeProject, 1999-2016
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