System.Data.SqlClient Namespace SqlConnection Class
Initializes a new instance of the SqlConnection class with the specified ConnectionString.
[ VB ]
Overloads Public Sub New ( _
ByVal connectionString As String _
)
[ C# ]
public SqlConnection (
string connectionString
);
[ C++ ]
public: SqlConnection (
String* connectionString
);
[ JScript ]
public function SqlConnection (
connectionString : String
);
- connectionString
- The connection used to open the SQL Server™ data store.
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.
string connString = "user id=sa; password=yervzeñun;" +
"initial catalog=northwind; data source=myServer";
SqlConnection myConn = new SqlConnection ( connString );
myConn.Open ( );
Dim connString As String = "user id=sa; password=yervzeñun;" &_
"initial catalog=northwind; data source=myServer"
Dim myConn As New SqlConnection ( connString )
myConn.Open ( ) |
|
C# |
VB |
SqlConnection Members ConnectionString SqlConnection Constructor Overload List