Your connection string should be as follows if using SQL-Server Express edition
Server=.\SQLEXPRESS;Database=NorthWind;Integrated Security=true
The connection string may be stored in app.config or if using .NET 5 in appsettings.json
{
"database": {
"DatabaseServer": ".\\SQLEXPRESS",
"Catalog": "NorthWind2020",
"IntegratedSecurity": "true",
"UsingLogging": "true"
},
"ConnectionStrings": {
"DevelopmentConnection": "Server=.\\SQLEXPRESS;Database=NorthWind2020;Integrated Security=true",
"ProductionConnection": "Server=.\\SQLEXPRESS;Database=NorthWind2020;Integrated Security=true"
},
"Environment": {
"Production": false
}
}
Now with that understood see my code samples, one uses Entity Framework Core (preferred) while the other uses a data provider. Both use the same connection string under ConnectionStrings -> DevelopmentConnection were Environment specifies prod or dev (yes both are the same but in a real app they would be different.
The database for the code sample is a modified version of the original NorthWind which I created in 2020 hence 2020 appended to the catalog name.
Here is the database script.