Showing posts with label sql connection. Show all posts
Showing posts with label sql connection. Show all posts

Tuesday, November 6, 2012

Connection strings for SQL Server 2008

.NET Framework Data Provider for SQL Server

Type:   .NET Framework Class Library Usage:  System.Data.SqlClient.SqlConnection Manufacturer:  Microsoft


Standard Security

Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;
 
 

Trusted Connection

Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
 
 

Connection to a SQL Server instance

The server/instance name syntax used in the server option is the same for all SQL Server connection strings.
Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername;
Password=myPassword;
 
 

Connect via an IP address

Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;
User ID=myUsername;Password=myPassword;
 
note:- DBMSSOCN=TCP/IP is how to use TCP/IP instead of Named Pipes. At the end of the Data Source is the port to use. 1433 is the default port for SQL Server.