M
MRM256
Guest
Hi Everyone:
Please forgive me, but I am not sure to which forum this question belongs.
I have a VB 2013 application that scans my home network looking for instances of MS SQL Server.
Currently, I have MS SQL Server 2017 installed on PC named MRM-WINX-002. Using 'Ping' I made sure I could ping MRM-WINX-001 from MRM-WINX-002 and vis-versa. MRM-WINX-002 uses McAfee as a firewall, but it says my home network is protected.
I can access SQL Server using SSMS from MRM-WINX-001. However, when I try to list the SQL Servers using my application I get a "connection failed" error. This doesn't make any since, because I can ping both systems.
The code to locate SQL Servers uses Imports System.Data.Sql and System.Data.SqlClient. The code is:
Public Function lst_SQLServers() As List(Of String)
'Purpose: List all instances of MS-SQL Servies on the
' the Network
'Parameters: None
'Returns: A List of SQL Server instances.
' declare variables
Dim dt As Data.DataTable = Nothing
Dim dr As Data.DataRow = Nothing
Dim listSQL As List(Of String) = New List(Of String)
Try
'get sql server instances in to DataTable object
dt = Sql.SqlDataSourceEnumerator.Instance.GetDataSources()
For I = 0 To dt.Rows.Count - 1 'Step I + 1
listSQL.Add(dt.Rows(I)(0).ToString)
'Debug.Print(dt.Rows(I)(0).ToString)
Next
Catch ex As System.Data.SqlClient.SqlException
'Log error
Dim el As New Log.ErrorLogger
el.WriteToErrorLog(ex.Message, _
ex.StackTrace, _
"Error - lst_SQLServers")
Catch ex As Exception
'Log error
Dim el As New Log.ErrorLogger
el.WriteToErrorLog(ex.Message, _
ex.StackTrace, _
"Error - lst_SQLServers")
Finally
'clean up
dr = Nothing
dt = Nothing
End Try
Return listSQL
End Function
This worked in the past. Can someone tell me why all of the sudden it doesn't?
Thanks,
MRM256
Continue reading...
Please forgive me, but I am not sure to which forum this question belongs.
I have a VB 2013 application that scans my home network looking for instances of MS SQL Server.
Currently, I have MS SQL Server 2017 installed on PC named MRM-WINX-002. Using 'Ping' I made sure I could ping MRM-WINX-001 from MRM-WINX-002 and vis-versa. MRM-WINX-002 uses McAfee as a firewall, but it says my home network is protected.
I can access SQL Server using SSMS from MRM-WINX-001. However, when I try to list the SQL Servers using my application I get a "connection failed" error. This doesn't make any since, because I can ping both systems.
The code to locate SQL Servers uses Imports System.Data.Sql and System.Data.SqlClient. The code is:
Public Function lst_SQLServers() As List(Of String)
'Purpose: List all instances of MS-SQL Servies on the
' the Network
'Parameters: None
'Returns: A List of SQL Server instances.
' declare variables
Dim dt As Data.DataTable = Nothing
Dim dr As Data.DataRow = Nothing
Dim listSQL As List(Of String) = New List(Of String)
Try
'get sql server instances in to DataTable object
dt = Sql.SqlDataSourceEnumerator.Instance.GetDataSources()
For I = 0 To dt.Rows.Count - 1 'Step I + 1
listSQL.Add(dt.Rows(I)(0).ToString)
'Debug.Print(dt.Rows(I)(0).ToString)
Next
Catch ex As System.Data.SqlClient.SqlException
'Log error
Dim el As New Log.ErrorLogger
el.WriteToErrorLog(ex.Message, _
ex.StackTrace, _
"Error - lst_SQLServers")
Catch ex As Exception
'Log error
Dim el As New Log.ErrorLogger
el.WriteToErrorLog(ex.Message, _
ex.StackTrace, _
"Error - lst_SQLServers")
Finally
'clean up
dr = Nothing
dt = Nothing
End Try
Return listSQL
End Function
This worked in the past. Can someone tell me why all of the sudden it doesn't?
Thanks,
MRM256
Continue reading...