I'm creating an simple exercise app to manage local database.
I'm using WPF app in VS 2022 and Wamp. For SQL management I'm using Microsoft.Data.SqlClient
You can check the whole code in my GitHub https://github.com/datecasp/C-Sharp_database_connect
My problem is that when I'm going to make a second query, I got an exception for SQL connection already in use.
As far as I know I should keep connection alive during the whole session so I don't understand why this is a problem... One by one (closing app after each query and restarting it again for the next one), everything is fine. But if a make two queries in a row (without exit the app) I get the exception
The connection gets closed when I close the app and exit.
Any idea please!!!