asp.net.ph

SqlConnection Constructor ( )

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

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.

SqlConnection myConn = new SqlConnection ( );
myConn.ConnectionString = "user id=sa; password=yervzeñun;" +
   "initial catalog=northwind; data source=myServer";
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