C
C#10mo 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
PixxelKick10mo ago
Looks like your OutputDir param got mangled
phaseshift
phaseshift10mo ago
I thought the context arg was the problem
PixxelKick
PixxelKick10mo ago
Is there supposed to be a space between Models\DataLayer and -ContextMMABooksContext?
phaseshift
phaseshift10mo ago
Like -Context is smushed to the value
PixxelKick
PixxelKick10mo 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
CoderMN10mo 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
JP10mo 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
PixxelKick10mo ago
Parameters here start with -
CoderMN
CoderMN10mo ago
Wow that did it
PixxelKick
PixxelKick10mo ago
So there should be a space before the -
CoderMN
CoderMN10mo ago
I didn't see that original comment Thank you!
Want results from more Discord servers?
Add your server