Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Attach SchoolDB.mdf to localdb #9

Open
johncblacker opened this issue Dec 22, 2023 · 1 comment
Open

Cannot Attach SchoolDB.mdf to localdb #9

johncblacker opened this issue Dec 22, 2023 · 1 comment

Comments

@johncblacker
Copy link

I just started working with this sample (and, by the way, it appears to me to be one of the best sites for help with entity framework) and ran into the attach problem with the error message indicating it couldn't find the .ldf file. My solution, thanks to my daughter who happens to be ea DBA is to execute this code from within MS SQL Server Studio:
sp_attach_db @dbname= N'SchoolDB'
, @filename1= N'C:\Users\jblac\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB\EF6-DBFirst-Demo\EF6DBFirstDemo\SchoolDB.mdf'

This was executed after right clicking on "New Query" in the toolbard, dropping the above code changed according to where you put the .mdf file and then selecting " Execute." This seems to me to be an easier solution than others that I looked at in the "closed issues" section and from searching online. I am using the pre-installed localdb (express) version running on windows 11.

@johncblacker
Copy link
Author

I suggest that the repository creator put my "fix" into the README as a step in getting started with the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant