•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 456,563 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,528 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser: Programming Forums
Views: 1386 | Replies: 0
![]() |
•
•
Join Date: Jan 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi all,
I need to build a application in which i have to test wheather sql server
2000 is connected or not.I cant be dependent on any query using master database as user might not have access to it.
I used following code
Try
Dim objIPHost As New System.Net.IPHostEntry
objIPHost = System.Net.Dns.Resolve(txtServer.Text)
Dim objAddress As System.Net.IPAddress
objAddress = objIPHost.AddressList(0)
Dim objTCP As System.Net.Sockets.TcpClient = _
New System.Net.Sockets.TcpClient
objTCP.Connect(objAddress, 1433)
objTCP.Close()
objTCP = Nothing
objAddress = Nothing
objIPHost = Nothing
MsgBox("Connection with server successful.", MsgBoxStyle.Information, strMsgCaption)
Catch ex As Exception
MsgBox("Connection with server failed.", MsgBoxStyle.Information, strMsgCaption)
Exit Sub
End Try
in this i have used default port no for sql server,but it will not be always the case.
so if any one tell how to generalise this.
I need to build a application in which i have to test wheather sql server
2000 is connected or not.I cant be dependent on any query using master database as user might not have access to it.
I used following code
Try
Dim objIPHost As New System.Net.IPHostEntry
objIPHost = System.Net.Dns.Resolve(txtServer.Text)
Dim objAddress As System.Net.IPAddress
objAddress = objIPHost.AddressList(0)
Dim objTCP As System.Net.Sockets.TcpClient = _
New System.Net.Sockets.TcpClient
objTCP.Connect(objAddress, 1433)
objTCP.Close()
objTCP = Nothing
objAddress = Nothing
objIPHost = Nothing
MsgBox("Connection with server successful.", MsgBoxStyle.Information, strMsgCaption)
Catch ex As Exception
MsgBox("Connection with server failed.", MsgBoxStyle.Information, strMsgCaption)
Exit Sub
End Try
in this i have used default port no for sql server,but it will not be always the case.
so if any one tell how to generalise this.
![]() |
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Can ping web IP address but cannot get on the Internet (Networking Hardware Configuration)
- limited or no connectivity (Networking Hardware Configuration)
- Limited or no Connectivity (Networking Hardware Configuration)
- An idiot with a networkin problem (Networking Hardware Configuration)
- Gateway help needed(thanks) (Networking Hardware Configuration)
- appletalk between OS 9 and OS 10.3 (OS 7 / 8 / 9)
- Bogged Down Internet Speed (Windows NT / 2000 / XP / 2003)
- XPpro to WinME networking from hell :( (Networking Hardware Configuration)
Other Threads in the MS SQL Forum
- Previous Thread: MSSQL Fields Out Of Order
- Next Thread: Conditional index unique check?


Linear Mode