C
C#2y ago
Jimmacle

By using DBFirst approch i'm trying to connect to the database but this error occuring why is this?

did you check the things the error mentions?
16 Replies
Spirit Flying
Spirit Flying2y ago
Actually I'm new to learn .NETCore this is why I can't understand this error
Jimmacle
JimmacleOP2y ago
the things it tells you to check are not .NET related
Spirit Flying
Spirit Flying2y ago
I'm trying to use DB code first approch
Jimmacle
JimmacleOP2y ago
yes, that is clear from your post title what does the error tell you to check?
Spirit Flying
Spirit Flying2y ago
Server is configured to allow connection
Jimmacle
JimmacleOP2y ago
and is your connection string correct?
Spirit Flying
Spirit Flying2y ago
and Scaffold-Dbcontext "Server=DESKTOP-U13V3A8\SQLSERVER2022DEV; Database=Company; Trusted_Connection=True; TrustServerCertificate=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models Yes my connection string is correct I'm sure but how to check Server is configured to allow connection? plz help
Jimmacle
JimmacleOP2y ago
can you connect to it with SSMS?
Spirit Flying
Spirit Flying2y ago
I can connect SSMS with database and created Employee table But IDK why it's throwing error while scafolding
Spirit Flying
Spirit Flying2y ago
Created table
No description
Jimmacle
JimmacleOP2y ago
what do you get when you execute SELECT @@servername?
Spirit Flying
Spirit Flying2y ago
in vs?
Jimmacle
JimmacleOP2y ago
in your database
Spirit Flying
Spirit Flying2y ago
just a sec I can select database not server sorry if I am wrong USE Company; I can execute above command How to check if that SQL Server is configured to allow remote connections.
Spirit Flying
Spirit Flying2y ago
No description
Spirit Flying
Spirit Flying2y ago
It is also connected then what is an issue? plz help if you will then I will learn new thing today before I sleep

Did you find this page helpful?