I created a SQL Server database in SQL Server Management Studio. Now I need to connect to it in my Visual Studio 2019 C# project.
Is it essential that I have to connect to the database in Visual Studio 2019? (Tools
>> Connect to database
menu)?
Because first I got this error that I don't have permission:
Turns out, I had to restart Visual Studio as Admin, that fixed it but next I get this error that file is in use:
The solution to this apparently is to detach my database from SQL Server Management Studio?
Does this mean I have to detach the database to connect to Visual Studio to connect to it? Do I have to attach it again in SQL Server Management Studio? Wonder if I will get error there then that it is being used elsewhere.
Can I just connect to the database without connecting it in Visual Studio?
What I really need is connection string but apparently I can only get that if I connect it in Visual Studio and not directly from SQL Server Management Studio. Is there a way I get connection string from the SQL Server Management Studio 18?