Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to find or load the registered .Net Framework Data Provider. (System.Data)

I open my SSMS and right click on DB and then Tasks -> IMport Data to import data from a source but as soon as I click I get this error:

Failed to find or load the registered .Net Framework Data Provider. (System.Data)

This is the full error:

===================================

This wizard will close because it encountered the following error: (Microsoft SQL Server)

------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=13.0.2164.0&EvtSrc=Microsoft.SqlServer.Management.UI.WizardFrameworkErrorSR&EvtID=UncaughtException&LinkId=20476

===================================

Exception has been thrown by the target of an invocation. (mscorlib)

------------------------------
Program Location:

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
   at Microsoft.SqlServer.Dts.DtsWizard.Step1.DataSourceComboBox_SelectedIndexChanged(Object sender, EventArgs e)
   at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
   at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value)
   at Microsoft.SqlServer.Dts.DtsWizard.Step1.OnInitializePage(EventArgs e)
   at Microsoft.SqlServer.Management.UI.WizardPage.RaiseEnterPage()
   at Microsoft.SqlServer.Management.UI.WizardForm.NextPage(WizardPage nextPage)
   at Microsoft.SqlServer.Management.UI.WizardForm.Next_Click(Object sender, EventArgs e)

===================================

Failed to find or load the registered .Net Framework Data Provider. (System.Data)

------------------------------
Program Location:

   at System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow)
   at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
   at Microsoft.SqlServer.Dts.DtsWizard.AdoNetForm..ctor(DataSourceInfo info, Boolean bDest, WizardInputs inputs, WizardPage page)

I have both SQL 2012 and SQL 2014 installed on my machine and I get the error in both. What would I do to fix this?

like image 923
Tim Liberty Avatar asked Jun 08 '17 14:06

Tim Liberty


1 Answers

AHHH! This same issue has been driving me crazy for months. But I just figured it out.

I had dead/outdated/errant entries in my machine.config files.

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config

In these locations I opened the machine.config files, and commented out the entries for Devart and MySql. I then closed/reopened SSMS, and Task -> Import no longer was throwing the error. Now I'm not saying that the MySQL nor DevArt providers are your specific issue, but it was "removing" these entries from the machine.config that fixed the issue for me.

<DbProviderFactories>
  <add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
  <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
  <!--<add name="dotConnect for MySQL" invariant="Devart.Data.MySql" description="Devart dotConnect for MySQL" type="Devart.Data.MySql.MySqlProviderFactory, Devart.Data.MySql, Version=8.4.492.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
  <add name="dotConnect for Oracle" invariant="Devart.Data.Oracle" description="Devart dotConnect for Oracle" type="Devart.Data.Oracle.OracleProviderFactory, Devart.Data.Oracle, Version=8.5.492.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
  <add name="dotConnect for PostgreSQL" invariant="Devart.Data.PostgreSql" description="Devart dotConnect for PostgreSQL" type="Devart.Data.PostgreSql.PgSqlProviderFactory, Devart.Data.PostgreSql, Version=7.4.492.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
  <add name="dotConnect for SQLite" invariant="Devart.Data.SQLite" description="Devart dotConnect for SQLite" type="Devart.Data.SQLite.SQLiteProviderFactory, Devart.Data.SQLite, Version=5.3.492.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
  <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
  -->
</DbProviderFactories>

Hope that helps you.

NOTE: my problem didn't go away until I commented out those entries from both the Framework and Framework64 folders.

like image 180
Ted Krapf Avatar answered Oct 11 '22 14:10

Ted Krapf