C
C#13mo ago
CoderMN

✅ 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
11 Replies
PixxelKick
PixxelKick13mo ago
Looks like your OutputDir param got mangled
phaseshift
phaseshift13mo ago
I thought the context arg was the problem
PixxelKick
PixxelKick13mo ago
Is there supposed to be a space between Models\DataLayer and -ContextMMABooksContext?
phaseshift
phaseshift13mo ago
Like -Context is smushed to the value
PixxelKick
PixxelKick13mo ago
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
CoderMN
CoderMNOP13mo ago
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
JP
JP13mo ago
run this
Scaffold-DbContext "Data Source=(LocalDB)\MSSQLLocalDB;AttachDBFilename=C:\C#\Database\MMABooks.mdf;Integrated security=True"Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models\DataLayer -Context MMABooksContext -DataAnnotations –Force
Scaffold-DbContext "Data Source=(LocalDB)\MSSQLLocalDB;AttachDBFilename=C:\C#\Database\MMABooks.mdf;Integrated security=True"Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models\DataLayer -Context MMABooksContext -DataAnnotations –Force
PixxelKick
PixxelKick13mo ago
Parameters here start with -
CoderMN
CoderMNOP13mo ago
Wow that did it
PixxelKick
PixxelKick13mo ago
So there should be a space before the -
CoderMN
CoderMNOP13mo ago
I didn't see that original comment Thank you!
Want results from more Discord servers?
Add your server