asp.net.ph

IDbConnection.ConnectionString Property

System.Data Namespace   IDbConnection Class


Sets or retrieves the string used to connect to a database.

Syntax


Script IDbConnection.ConnectionString [ = connectString ]

Property Value


connectString A string that contains the connection settings.

The property is read/write with no default value.

Exceptions


Exception Type Condition
ArgumentException Occurs when an invalid connection string argument has been supplied or a required connection string argument has not been supplied.

Remarks

The ConnectionString property can only be set while the connection is closed.

Example

The following example instantiates an IDbConnection, sets some of its parameters in the connection string, and opens the connection.

SqlConnection myConn = new SqlConnection ( );
myConn.ConnectionString = "user id=sa; password=yervzeñun;" +
   "data source=myServer; initial catalog=northwind;"
myConn.Open ( );
  C# VB

See Also

IDbConnection Members   ConnectionTimeout   Database   Connecting to a Database 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