-2
I am wanting to connect to the database but my string Connection is not starting.
Error: https://prnt.sc/ngeqde
Class Startup
:
var connectionString = this.Configuration.GetConnectionString("PokemonBD");
services.AddTransient<IDataBaseContext>(contex =>
new DatabaseContext(new SqlConnection()));
services.AddTransient<IpokemonRepository, PokemonRepository>();
Appsetting.Development.json
"ConnectionString": {
"PokemonBD": "Server=tcp:****.database.windows.net,1433;Initial Catalog=DbPokemon;Persist Security Info=False;User ID=****;Password=****;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
}
Permission not accepted, seems user and password wrong
– novic
Not using the same ID and Pass to connect to Azure Data Studio
– B.Martins
services.AddTransient< IDataBaseContext >(contex => new DatabaseContext(new SqlConnection(connectionString )));
try like this– novic
I’ve done it, it didn’t work
– B.Martins
class:
DatabaseContext
– novic
You did, but another problem came up, but thank you very much
– B.Martins