C# WinFor 项目链接数据库问题

电小商发射biu
  • 34

刚刚拿到一个C#小程序,想在自己的电脑上运行并导入数据。但是我原来没有接触过EF,想问问大家怎么把这个项目的数据库链接匹配到自己的SQL SERVER上面。

clipboard.png

下面是App.config里面的代码
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>

<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

</configSections>
<connectionStrings>

<add name="eng__.Properties.Settings.eng__ConnectionString" connectionString="Data Source=localhost;Initial Catalog=eng++;Integrated Security=True" providerName="System.Data.SqlClient" />

<add name="engcEntities" connectionString="metadata=res:///engcDB.csdl|res:///engcDB.ssdl|res://*/engcDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=涛之笔记SQLEXPRESS;initial catalog=eng++;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>
<startup>

<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />

</startup>
<entityFramework>

<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
  <parameters>
    <parameter value="mssqllocaldb" />
  </parameters>
</defaultConnectionFactory>
<providers>
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>

</entityFramework>
</configuration>

回复
阅读 1.5k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进