简体   繁体   English

无法将文件附加为数据库

[英]Cannot attach the file as database

I've already seen all other post and seems cant help me. 我已经看过所有其他帖子,似乎无法帮助我。

String constr = (@"Data Source=(localdb)\MSSQLLocalDB;
        AttachDbFilename= E:\Downloads Mainframe\Compressed\Main Menu\HRDAssets.mdf;
        initial catalog=HRDAssets; 
        Integrated Security=True;");

https://cdn.discordapp.com/attachments/268002637905920001/506753130848059394/unknown.png https://cdn.discordapp.com/attachments/268002637905920001/506753130848059394/unknown.png

When I removed 当我删除

AttachDbFilename= E:\Downloads Mainframe\Compressed\Main Menu\HRDAssets.mdf;

new problem pops 新问题弹出

https://cdn.discordapp.com/attachments/506763196225421312/506763211492556800/unknown.png https://cdn.discordapp.com/attachments/506763196225421312/506763211492556800/unknown.png

Remove this line from the connection string 从连接字符串中删除此行

AttachDbFilename= E:\Downloads Mainframe\Compressed\Main Menu\HRDAssets.mdf;

and Initial Catalog property I suggest to use: 初始目录属性,我建议使用:

Data Source=(LocalDb)\MSSQLLocalDB;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\HRDAssets.mdf

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法将文件“ &lt;&gt;。mdf”附加为数据库“ &lt;&gt;” - Cannot attach the file '<>.mdf' as database '<>' 无法将文件.mdf作为数据库附加到多个项目中 - Cannot attach the file .mdf as database in multiple projects 更新数据库后,无法将文件“ .mdf”附加为数据库“ aspnet” - Cannot attach the file ''.mdf' as database 'aspnet after updating database 在其他计算机上安装应用程序时无法附加数据库文件 - Cannot attach database file when setup application on other computer 无法在分区解决方案的子解决方案中将文件附加为数据库 - Cannot attach a file as database in child solution of partitioned solutions DataException-无法在C#中将文件附加为数据库EntityFramework - DataException - Cannot attach file as database EntityFramework in C# 在MVC中使用LocalDb从App_Data文件夹中删除数据库时出现“无法附加文件”错误? - “Cannot attach the file” error when deleting a database from the App_Data folder with LocalDb in MVC? 使用 Hangfire,Startup.cs 中给出的连接字符串抛出无法附加文件作为数据库错误 - Using Hangfire, connection string given in Startup.cs throws Cannot attach file as database error “数据库已经存在。 选择一个不同的数据库名称。 恢复C#Win App数据库后,无法附加文件…”错误 - “Database already exists. Choose a different database name. Cannot attach the file…” error after restoring database of c# win app SqlException(0x80131904):无法附加文件 - SqlException (0x80131904): Cannot attach file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM