M
MRM256
Guest
Hi Everyone,
I got so frustrated trying to get my application to list my instances of SQL Server that I put it on hold for awhile.
I am using VS2017 which is installed on my PC named MRM-WINX-001. I also have SSMS installed on the same PC.
Using SSMS I can access my SQL Server 2017 instance which is installed on my PC named MRM-WINX-002. So it doesn't look like there is a problem on my home network. I can access SQL Server without any problems.
So I went on the Internet and found the simplest example of listing instances of SQL Server.
Imports System.Data.Sql
Module Module1
Sub Main()
Dim instance As SqlDataSourceEnumerator = SqlDataSourceEnumerator.Instance
Dim table As System.Data.DataTable = instance.GetDataSources()
DisplayData(table)
Console.WriteLine("Press any key to continue.")
Console.ReadKey()
End Sub
Sub DisplayData(ByVal table As System.Data.DataTable)
For Each row As System.Data.DataRow In table.Rows
For Each col As System.Data.DataColumn In table.Columns
Console.WriteLine("{0} = {1}", col.ColumnName, row(col))
Next
Console.WriteLine("============================")
Next
End Sub
End Module
When I ran the program my result was:
It should have listed my PC MRM-WINX-002, but it didn't. Something is broken somewhere.
Does anybody have any insights?
Thanks,
MRM256
Continue reading...
I got so frustrated trying to get my application to list my instances of SQL Server that I put it on hold for awhile.
I am using VS2017 which is installed on my PC named MRM-WINX-001. I also have SSMS installed on the same PC.
Using SSMS I can access my SQL Server 2017 instance which is installed on my PC named MRM-WINX-002. So it doesn't look like there is a problem on my home network. I can access SQL Server without any problems.
So I went on the Internet and found the simplest example of listing instances of SQL Server.
Imports System.Data.Sql
Module Module1
Sub Main()
Dim instance As SqlDataSourceEnumerator = SqlDataSourceEnumerator.Instance
Dim table As System.Data.DataTable = instance.GetDataSources()
DisplayData(table)
Console.WriteLine("Press any key to continue.")
Console.ReadKey()
End Sub
Sub DisplayData(ByVal table As System.Data.DataTable)
For Each row As System.Data.DataRow In table.Rows
For Each col As System.Data.DataColumn In table.Columns
Console.WriteLine("{0} = {1}", col.ColumnName, row(col))
Next
Console.WriteLine("============================")
Next
End Sub
End Module
When I ran the program my result was:
It should have listed my PC MRM-WINX-002, but it didn't. Something is broken somewhere.
Does anybody have any insights?
Thanks,
MRM256
Continue reading...