Monday, December 26, 2016

Creating connection string in Visual Studio

To create a connection string in Visual Studio follow the below steps -

1. Go to tools
 

2. Select connect to database, A pop up window will emerge.





3. Put server name.

4. Select Windows authentication or SQL server authentication on log on to the server section. If you choose SQL Server Authentication you need to fill Username and Password.

5. Choose database name from connect to database name section

6. Click in Test Connection button. if every thing OK, a message window would
popup. Select okay.

7. Then click the Advanced button and right there is the connection string.




 

But in case of SQL Server Authentication you have to manually
type the password in the connection string.



Sample connection string-

SQL Server Authentication

"Data Source=SqlServerName;Initial Catalog=DataBaseName;User ID=YourUserName;Password=YourPassword"

Windows Authentication 

"Data Source=SqlServerName;Initial Catalog=DataBaseName;Integrated Security=True"

See video tutorial from CodesWizard from Creating connection string in Visual Studio.


Happy Coding ...!!!