asp.net.ph

SqlConnection Constructor ( String )

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
);

Parameters

connectionString
The connection used to open the SQL Server™ data store.

Remarks

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.

Properties Initial Value
ConnectionString empty string ( "" )
ConnectionTimeout 15
Database empty string ( "" )
DataSource empty string ( "" )

You can change the value for these properties only by using the ConnectionString property.

Example

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 ( );
  C# VB

See Also

SqlConnection Members   ConnectionString   SqlConnection Constructor Overload List Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph