Failed to attach database to server XXX, failed to attach database xxx
I recently learned MVC + EF and watched the video for a small demo. EF needs to be connected to the database. The example in the video is quite similar to that in the previous database of niuyun news system. Therefore, the database is stolen and used, but an error occurred while attaching the database.
The error is as follows:
At first, I thought there was a problem with the database location, so I placed a new location, which is still invalid. Finally, find a solution on the Internet. Fortunately, some people have encountered such problems and there are several solutions. I used two methods to share them:
Method 1:
Copy the file to be appended to the default Data directory of SQL Server. The attachment is successful.
Method 2:
Use window to log on. You can also attach a database to the database without using the SQL Hybrid Authentication mode.
Both methods can be implemented. You can try other methods.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.