首页 » 技术分享 » c#访问各数据库的providerName各驱动

c#访问各数据库的providerName各驱动

 

如果为Mysql 数据库—>providerName=”MySql.Data.MySqlClient”(没装mysql dotnet 安装版的话就得在C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/CONFIG中machine.config加语句了)

在machine.config文件中有这么一段,如果没有name=”MySQL Data Provider” 则会出现这种错误。


<system.data>
    <DbProviderFactories>
      <add name="Odbc Data Provider" invariant="System.Data.Odbc" description=".Net Framework Data Provider for Odbc" type="System.Data.Odbc.OdbcFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      <add name="OleDb Data Provider" invariant="System.Data.OleDb" description=".Net Framework Data Provider for OleDb" type="System.Data.OleDb.OleDbFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      <add name="OracleClient Data Provider" invariant="System.Data.OracleClient" description=".Net Framework Data Provider for Oracle" type="System.Data.OracleClient.OracleClientFactory, System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      <add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      <add name="SQL Server CE Data Provider" invariant="Microsoft.SqlServerCe.Client" description=".NET Framework Data Provider for Microsoft SQL Server 2005 Mobile Edition" type="Microsoft.SqlServerCe.Client.SqlCeClientFactory, Microsoft.SqlServerCe.Client, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=5.0.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>
</system.data>

如果为Aceess数据库—>providerName=”System.Data.OleDb”

如果为Oracle 数据库—>providerName=”System.Data.OracleClient”或者providerName=”Oracle.DataAccess.Client”

如果为SQLite数据库—>providerName=”System.Data.SQLite”

如果为sql 数据库—>providerName=”System.Data.SqlClient”

转载自原文链接, 如需删除请联系管理员。

原文链接:c#访问各数据库的providerName各驱动,转载请注明来源!

0