Category Archives: ASP.Net

Connection Strings for MS SQL Server

I find it helpful to have these stored in a file so i don’t have to keep missing out silly keywords when am writing a connection string.  Hope you find them handy too 🙂

Standard Security

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

Don’t forget to use SERVERNAME\INSTANCENAME as Data Source to connect to a specific SQL Server instance.
Are you using an EXPRESS Edition? use SERVERNAME\EXPRESS as Datasource

Standard Security alternative syntax
This connection string is similar the previous, just some keyword changes which means the same thing.

Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;

Trusted Connection

Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;

Trusted Connection alternative syntax
This connection string produce the same result as the previous one. The reason to include it is to point out that some connection string keywords have many equivalents.


Connecting to an SQL Server instance
The syntax of specifying the server instance in the value of the server key is the same for all connection strings for SQL Server.


For more about connection string visit