0

I'm making a WPF application with a local database,

I made the database with SQL server management studio, then I linked a .edmx file to the database I made.

Now if i wanna run my program on another PC i don't have that database anymore so it kinda crashes. Can I copy my database file (.mdf) in my Debug folder and change my App.Config so it takes that database?

Becouse I wanna copy my program to a computer that dosn't have SQL server Management studio installed. Is that posible?

My App.Config looks like this atm:

<connectionStrings>
<add name="PRCEntities" connectionString="metadata=res://*/PRC.csdl|res://*/PRC.ssdl|res://*/PRC.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=DESKTOP-BERNARD\SQLEXPRESS;Initial Catalog=PRC;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>
</configuration>

Thx

4

1 回答 1

0

您可以复制 mdf,但是:

  • 目标计算机必须安装 SQL Server
  • 您必须附加 mdf 文件
  • 您需要更改连接字符串,或者让安装应用程序的用户输入它,或者将机器名称更改为 localhost,但您可能会遇到具有命名实例且没有默认实例的机器。
于 2012-08-28T15:15:12.213 回答