Rositsa Ruseva

Rositsa Ruseva

  • 1.5k
  • 218
  • 36k

Problem with updating the database

Jun 29 2022 6:15 PM

I am taking a course with Blazor and we are creating at the moment a server.
I have an issue with the EF migrations. I have created a migration using the package manager console and after that, the command that I use is "update-database". However, after the "Build succeeded" is displayed and a few libraries are loaded the following is displayed: "Keyword not supported: 'trusted_connection:true;multipleactiveresultsets'. And I have nothing in the database. 

I think that maybe there is something wrong with my connection string: "DefaultConnection": "Server=.;Database=HiddenVilla;Trusted_Connection:True;MultipleActiveResultSets=true"

 

Any idea how I can fix this?


Answers (3)

3
Sachin Singh

Sachin Singh

  • 7
  • 55.8k
  • 83.6k
Jun 29 2022 6:32 PM
use the below connection string
  1. "DefaultConnection""Server=(localdb)\\mssqllocaldb;Database=YourDBName;Trusted_Connection=True;MultipleActiveResultSets=true"  
 and make sure following Nuget packages are installed.
Microsoft.EntityFrameworkCore
 Microsoft.EntityFrameworkCore.SqlServer
Accepted Answer
3
Satya Karki

Satya Karki

  • 8
  • 55.7k
  • 3.5m
Jun 30 2022 4:19 AM

Hi, check your server(data source) and database name. If you are using double backslash in the server name then try using single.

"DefaultConnection": "Server=(localdb)\mssqllocaldb;Database=YourDBName;Trusted_Connection=True;MultipleActiveResultSets=true" 

2
Rositsa Ruseva

Rositsa Ruseva

  • 1.5k
  • 218
  • 36k
Jul 1 2022 4:04 AM
Thanks for the answers :)