Get SQL Server Database Connection String Easily from Visual Studio






3.86/5 (5 votes)
How to get SQL Server database connection string easily from Visual Studio
- Before getting to know this, you should
know the following details of SQL Server:
- Server Name
- Username
- Password
- Database name which you want to connect
- Open Visual Studio.
- Go to view => Server Explorer.
- Right click on Data Connections and select Add Connection (or) click on Connect to Database icon.
- You will get add connection window.
Provide Server name.
Select Use SQL Server Authentication radio button. Then submit the username and password.
If you enter correct details, you can select the database you want to connect from the “Select or enter a database name” dropdown list.
- Click on Test Connection button. If you submit the correct credentials, you will get the Test connection succeeded confirmation message.
- Now your connection is working successfully so, now click on ok button. You will get one data connection under Data Connections.
- Right click on your connection and select properties.
- You will get properties window of your connection. Find Connection String property and select the connection string.
- So now your connection string is in your hands you can use it anywhere you want.