Reputation: 163
using System;
using System.Data;
using System.Data.Sql;
using System.Collections;
namespace Tinkering_with_SqlDataSourceEnumerator
{
class Program
{
static void Main()
{
SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;
}
}
}
When I try to run this code, the system gives the following error:
The type or namespace name 'SqlDataSourceEnumerator' does not exist in the namespace 'System.Data.Sql' (are you missing an assembly reference?)
What am I doing wrong? Curiously, an application that was included with a programming textbook launches without problems, at least it does not produce this error message, and the term SqlDataSourceEnumerator
is not underscored red in Visual Studio
I wanted to create an instance of SqlDataSourceEnumerator
, similarly to the code provided on the MSDN page about this object.
Upvotes: 3
Views: 2764
Reputation: 438
This has finally been moved into the Microsoft.Data.SqlClient
library: SqlClientFactory
Upvotes: 4
Reputation: 426
Whilst not a direct replacement for SqlDataSourceEnumerator. Until the SQLClient team addresses the missing api you could try a Udp solution.
This repo is targetted at .Net5, but should work just fine on .NetCore
https://github.com/mrsquish/SqlBrowserClient
Upvotes: 1
Reputation: 406
Supported Platforms: .NET Framework 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6 4.5.2 4.5.1 4.5 4.0 3.5 3.0 2.0 Xamarin.Android 7.1 Xamarin.iOS 10.8 Xamarin.Mac 3.0
Try changing target platform for your project.
Upvotes: 2