✅ DB Error
Hey guys, I am working on a project and I am trying to connect it to a DB. I am following the instructions but continue to get this error message even after replacing the original text with the correct DB location.
Any thoughts or suggestions would be great!
Here is the original text to place in the PMC:
Scaffold-DbContext "Data Source=(LocalDB)\MSSQLLocalDB;AttachDBFilename=C:\C#\Database\MMABooks.mdf;Integrated security=True"Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models\DataLayer -ContextMMABooksContext -DataAnnotations –Force
![No description](https://cdn.answeroverflow.com/1175595960601149550/Screenshot_2023-11-18_181759.png)
11 Replies
Looks like your OutputDir param got mangled
I thought the context arg was the problem
Is there supposed to be a space between
Models\DataLayer
and -ContextMMABooksContext
?Like -Context is smushed to the value
Or should that all be a single "word"
Oh yeah that's prolly it
This is all overkill BTW
Use a startup project that has all the values set
Oh wait sorry
This is Scaffold not Update, fair enough
Scaffold-DbContext –Connection "Data Source=(LocalDB)\MSSQLLocalDB;AttachDBFilename=C:\C#\Database\MMABooks.mdf;Integrated security=True"-Provider Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models\DataLayer-Context MMABooksContext -DataAnnotations –Force
This is the other one that they say to use but I am getting the same error
This one says it is for sql server exoress lovalDB though
run this
Parameters here start with
-
Wow that did it
So there should be a space before the -
I didn't see that original comment
Thank you!