Click here to Skip to main content
11,644,731 members (65,484 online)
Rate this: bad
good
Please Sign up or sign in to vote.
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
0 OriginalGriff 680
1 jyo.net 494
2 Sergey Alexandrovich Kryukov 464
3 Afzaal Ahmad Zeeshan 418
4 CPallini 336
0 OriginalGriff 925
1 DamithSL 636
2 Afzaal Ahmad Zeeshan 622
3 Sergey Alexandrovich Kryukov 548
4 CPallini 521


Advertise | Privacy | Mobile
Web04 | 2.8.150731.1 | Last Updated 16 Jan 2013
Copyright © CodeProject, 1999-2015
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