Standard Security

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


Trusted Connection

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


Connection to a SQL Server instance

Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername;

 

 

Context Connection

C#

 using(SqlConnection connection = new SqlConnection("context connection=true"))
 {
     connection.Open();
     // Use the connection
 }

VB.Net
 Using connection as new SqlConnection("context connection=true")
     connection.Open()
     ' Use the connection

 

 ขอบคุณครับจารย์ วิคาร..