2010-12-03 17 views
1

我在第一次在C#桌面應用程序中使用Mindspace.Lightspeed,但出現錯誤並無法連接到數據庫。 alt textMindscape.LightSpeed數據庫連接問題

我的App.config中包含以下代碼:

<?xml version="1.0" encoding="utf-8" ?><configuration> 
<configSections> 
<section name="lightSpeedContext" type="Mindscape.LightSpeed.Configuration.LightSpeedConfigurationSection,Mindscape.LightSpeed" /></configSections><connectionStrings> 
<add name="DefectsConStr" connectionString="Data Source=.\sqlexpress2k5;Initial Catalog=Defects;Persist Security Info=True;User ID=sa;Password=123" 
    providerName="System.Data.SqlClient" /></connectionStrings> <lightSpeedContext> 
<add name="Development" connectionStringName="DefectsConStr" dataProvider="SqlServer2005"/> </lightSpeedContext> </configuration> 

回答

2

我已成功地重現您的問題,您需要更改配置文件,以便在節的名稱是

lightSpeedContexts而不是lightSpeedContext

看到我的配置文件

<?xml version="1.0"?> 
<configuration> 
    <configSections> 
    <section name="lightSpeedContexts" type="Mindscape.LightSpeed.Configuration.LightSpeedConfigurationSection,Mindscape.LightSpeed"/> 
    </configSections> 
    <connectionStrings> 
    <add name="Blog" connectionString="Data Source=Blog.dat"/> 
    </connectionStrings> 
    <lightSpeedContexts> 
    <add name="Blog" connectionStringName="Blog" dataProvider="SQLite3" identityMethod="KeyTable" pluralizeTableNames="false"/> 
    </lightSpeedContexts> 
</configuration>