![](/img/trans.png)
[英]Is possible to create a database (Sql Server compact) on a given path if we use Entity framework with code-first approach?
[英]how can i create sql database by entity framework code first in specific path
我首先使用以下字符串在實體框架代碼中成功創建了我的數據庫:
Data Source=DESKTOP-PL8EDEA;Initial Catalog=MyDB;Integrated Security=True;TimeOut=3600
此頂部連接字符串在 sql server 數據庫的默認地址中創建數據庫,但我希望將數據庫保存在我想要的路徑中我也嘗試了此字段,但沒有成功
Data Source=DESKTOP-PL8EDEA;Initial Catalog=|D:\MyFolder|\MyDB;Integrated Security=True;TimeOut=3600
您可以指定路徑:
Server=.\SQLExpress;AttachDbFilename=C:\MyFolder\MyDataFile.mdf;Database=dbname;Trusted_Connection=Yes;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.