cannot use a dll that has subsonic dataaccess
i generated my dataaccess dll using subsonic 3.0. i have a new proj referenced to this dll and am tryign to insert data to my mysql database. i get the following configuration error. however when i look at my App.config, i have a connectionstring that defines my database connection.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="dbTorontoTrader"
connectionString="server=localhost;database=dbtorontotrader;user id=root; password=password"
providerName="MySql.Data.MySqlClient"/>
<!-- For MySQL -->
</connectionStrings>
<system.data>
<DbProviderFactories>
<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.1.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
</configuration>
System.Configuration.ConfigurationErrorsException was unhandled
开发者_如何学Python Message="Failed to find or load the registered .Net Framework Data Provider."
Source="System.Data"
BareMessage="Failed to find or load the registered .Net Framework Data Provider."
Line=0
StackTrace:
at System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow)
at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
at SubSonic.DataProviders.DbDataProvider..ctor(String connectionString, String providerName)
at SubSonic.DataProviders.ProviderFactory.LoadProvider(String connectionString, String providerName)
at SubSonic.DataProviders.ProviderFactory.GetProvider(String connectionStringName)
at TorontoTrader.Data.Ver2.dbTorontoTraderDB..ctor() in E:\TradingTools\CODE\TorontoTraderDataVer2\TorontoTraderDataVer2\Context.cs:line 37
at TorontoTrader.Data.Ver2.scans_log.GetRepo(String connectionString, String providerName) in E:\TradingTools\CODE\TorontoTraderDataVer2\TorontoTraderDataVer2\ActiveRecord.cs:line 10338
at TorontoTrader.Data.Ver2.scans_log.GetRepo() in E:\TradingTools\CODE\TorontoTraderDataVer2\TorontoTraderDataVer2\ActiveRecord.cs:line 10354
at TorontoTrader.Data.Ver2.scans_log.SingleOrDefault(Expression`1 expression) in E:\TradingTools\CODE\TorontoTraderDataVer2\TorontoTraderDataVer2\ActiveRecord.cs:line 10359
at ConsoleApplication1.Program.Main(String[] args) in E:\TradingTools\CODE\TorontoTraderDataVer2\ConsoleApplication1\Program.cs:line 13
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
your app config should look like this:
<configuration>
<connectionStrings>
<add name="dbTorontoTrader" connectionString="server=localhost;database=dbtorontotrader;user id=root; password=password" providerName="MySql.Data.MySqlClient"/>
</connectionStrings>
</configuration>
Make note of the element that is missing
You need to add connectionstrings element.
Your app.config should look like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="dbTorontoTrader"
connectionString="server=localhost;database=dbtorontotrader;user id=root; password=password"
providerName="MySql.Data.MySqlClient"/>
</connectionStrings>
</configuration>
精彩评论