Hi SajoNez1510-5981,
Is the connection status and database name correctly output when the project is running? If not, what is wrong with the code.
I used your code to do a test and it can output correctly, the only difference is the connection string.
I followed the steps below to get the connection string. You can refer to the following:
View->SQL Server Object Explore->Right click my Database name->Properties->Connection String-> Copy it to configuration file.
Here is test result:
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.