DbProviderFactories.GetFactory(dbProviderName)

 

DBProviderFactory factory = DBProviderFactorys.GetFactory("System.Data.SqlClient"); //可通过配置改变
DBConnection conn = factory.CreateConnection();
conn.ConnectionString = .....

 

providerInvariantName:

System.Data.SQLite

System.Data.SqlClient

 

 

SQLite的支持,如果不支持,会报错,

找不到请求的 .Net Framework Data Provider。可能没有安装.

解决办法:

 

machine.config中加一个Provider配置(C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config),打开,约在129行,有个DbProviderFactories配置节,再添加一个SQLITE3的。如下:

 

<add name="SQLite3 Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite3.X" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>

http://www.cnblogs.com/Don/p/3633098.html

 

posted on 2016-06-13 20:37  lypzxy  阅读(1643)  评论(0编辑  收藏  举报