Tag: connection string

应用程序configuration文件中的连接string“MyConnection”不包含所需的providerName属性。

我使用Entity Framework Code First , 我的连接string在configuration文件中: <connectionStrings> <clear/> <add name="ApplicationServices" connectionString="Data Source=PC-X;Initial Catalog=MYdb;Integrated Security=True"/> </connectionStrings> 当我尝试访问数据(应该创build数据库的东西)正在下降,出现以下错误: The connection string 'ApplicationServices' in the application's configuration file does not contain the required providerName attribute." 我错过了什么?

使用Windowsvalidation的连接string

我正在创build一个网站,但在数据库中我使用Windows身份validation。 我知道你使用这个SQLauthentication <connectionStrings> <add name="NorthwindContex" connectionString="data source=localhost; initial catalog=northwind;persist security info=True; user id=sa;password=P@ssw0rd" providerName="System.Data.SqlClient" /> </connectionStrings> 我如何修改这个以使用Windows身份validation?

我应该如何编辑entity framework连接string?

我最近不得不编辑我的app.config文件来更改entity framework数据模型( .edmx文件)的连接string。 但我想知道: 有没有办法编辑EF连接string使用devise器? 原始连接string由“实体数据模型”向导自动生成。 连接string不能更改 – 在.edmxdevise器的属性窗口中保持禁用状态。 我喜欢避免手动编辑XML(在app.config中),所以我想知道是否有办法返回到原始向导屏幕来更改连接string并让工具编辑app.config文件为了我。

entity framework代码的SQL Server Express连接string首先

我正在使用Visual Web Developer 2010 Express,并使用entity framework代码优先CTP。 我能够用新的SQL Server CE做到这一点,但我无法find一个连接string与SQL Server Express的工作。 这一个,使用SQL Server CEtesting版,工作正常(数据库创build和模型更改重新创build)。 <add name="TrempimModel" connectionString="data source=|DataDirectory|TrempimModel.sdf" providerName="System.Data.SqlServerCe.4.0" /> 这一个,我从aspnetdb连接string复制, <add name="TrempimModel" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI; AttachDBFilename=|DataDirectory|TrempimModel.mdf;User Instance=true" providerName="System.Data.SqlClient" /> 在启动时提供以下消息: 无法完成操作。 提供的SqlConnection不指定初始目录 那么如何使它与SQL Server Express一起工作呢?

EntityFramework代码优先自定义连接string和迁移

当我使用默认的连接string(从app.config读取)创build一个上下文时,数据库被创build并且迁移工作 – 基本上所有东西都是按顺序的。 而当以编程方式创build连接string(使用SqlConnectionStringBuilder )时: 当数据库不存在时,数据库不会被创build(schemeA ); CreateDbIfNotExists()创build最新版本的数据库模型,但不会调用迁移机制(schemeB )。 在A ,当我想访问数据库时抛出一个exception,显然,它不在那里。 在B数据库中创build正确的迁移机制不会被调用,就像标准连接string中的情况一样。 app.config :“ Data Source=localhost\\SQLEXPRESS;Initial Catalog=Db13;User ID=xxx;Password=xxx ” build设者 : sqlBuilder.DataSource = x.DbHost; sqlBuilder.InitialCatalog = x.DbName; sqlBuilder.UserID = x.DbUser; sqlBuilder.Password = x.DbPassword; 初始值设定项 Database.SetInitializer( new MigrateDatabaseToLatestVersion< MyContext, Migrations.Configuration >() ); 规格 :entity framework:5.0,DB:SQL Server Express 2008