Mindscape.LightSpeed数据库连接问题

时间:2010-12-03 09:41:34

标签: c# connection-string lightspeed

我第一次在我的C#桌面应用程序中使用Mindspace.Lightspeed但是我收到错误并且无法连接到数据库。 alt text

我的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>

1 个答案:

答案 0 :(得分: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>