I have been connecting to my local database (SQL Express) fine all day from my C# console application.
I have made an update, where I create a database and table from within the C# code using ADO.NET
When I do this, my normal connection string fails, which is
Data Source=.\\sqlexpress; Trusted_Connection=True; Initial Catalog=ThisIsMyDataBase;
The error message is
Cannot open database "ThisIsMyDataBase" requested by the login. The login failed.\r\nLogin failed for user 'My-PC\\MrD'.
If I open the tables in SSMS, then I can access everything, using Windows Authentication.
I was under the impression that the Trusted_Connection=True
would mean I have permission, and that I'm accessing it with my Windows account (not an SQL account) would mean I don't see this issue, but I'm clearly wrong. I'm not sure how to solve this.