Sql-server – Connecting SQL Server Developer Edition to Visual Studio Windows Forms Application

sql servervisual studio

I downloaded the free SQL Server Developer Edition in hopes of being able to use SQL Server for my Visual studio project, but I can't seem to understand how to connect it. 🙁

In my SQL Management Studio I never received login credentials to log in with, for the server named LAPTOPXXXX/OwnerName, so I can't connect through SQL Authentication in Visual Studio. Nor is there a create new credentials option anywhere to be found. Also when trying to connect to the server using my computer name or IP address it also fails to connect to the server I downloaded.

How do I make log in credentials for my free server and how do I connect it using like a web.config or app.config file's connectionstring (but winforms version)?

Best Answer

1) Create an application user for your app on the SQL Server instance. Never use an administrative user or SA.

2) Create a DSN (Data source Name) on the machine that the app will connect to the SQL Server database. This applies even if the two are on the same machine (which would be poor architecture, but possible in a solitary dev environment).

2a) The login credentials for this DSN should be the app's user in SQL Server

3) Go to ConnectionStrings.com and generate a SQL connection string based on the DSN you just made. (https://www.connectionstrings.com/dsn/)

4) Use the connection string in your app/web config and reference it in the SQLConnection call.