System.Data.SqlClient Namespace SqlConnection Class
Initializes a new instance of the SqlConnection class.
[ VB ]
Overloads Public Sub New ( )
[ C# ]
public SqlConnection ( );
[ C++ ]
public: SqlConnection ( );
[ JScript ]
public function SqlConnection ( )
When an instance of SqlConnection is created, the following read/write properties are set to initial values, unless they are specifically set using their associated keywords in the ConnectionString property.
You can change the value for these properties only by using the ConnectionString property.
The following example initializes and opens an SqlConnection using this constructor.
SqlConnection myConn = new SqlConnection ( );
myConn.ConnectionString = "user id=sa; password=yervzeñun;" +
"initial catalog=northwind; data source=myServer";
myConn.Open ( );
Dim myConn As New SqlConnection ( )
myConn.ConnectionString = "user id=sa; password=yervzeñun;" &_
"initial catalog=northwind; data source=myServer"
myConn.Open ( ) |
|
C# |
VB |
SqlConnection Members ConnectionString SqlConnection Constructor Overload List