Advertisement
steverobinson

MSSQLS 2008 Conn. Strings

Jan 19th, 2011
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.81 KB | None | 0 0
  1. //MS SQL Server Connection strings
  2.  
  3. //Standard Security
  4. Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
  5.  
  6. //Use serverName\instanceName as Data Source to connect to a specific SQL Server instance.
  7.  
  8. //Are you using SQL Server 2008 Express? Don't miss the server name syntax Servername\SQLEXPRESS where you substitute Servername with the name //of the computer where the SQL Server Express installation resides.
  9.  
  10. //Standard Security alternative syntax
  11. //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.
  12.  
  13. Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;
  14.  
  15.  
  16. //Trusted Connection
  17. Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
  18.  
  19.  
  20. //Trusted Connection alternative syntax
  21. //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.
  22. Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
  23.  
  24.  
  25. //Connecting to an SQL Server instance
  26. //The syntax of specifying the server instance in the value of the server key is the same for all connection strings for SQL Server.
  27. Server=myServerName\theInstanceName;Database=myDataBase;Trusted_Connection=True;
  28.  
  29.  
  30. //Trusted Connection from a CE device
  31. //Often a Windows CE device is not authenticated and logged in to a domain. To use SSPI or trusted connection / authentication from a CE //device, use this connection string.
  32. Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;User ID=myDomain\myUsername;Password=myPassword;
  33. //Note that this will only work on a CE device.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement