| |||||||
OleDbConnection.Open MethodSystem.Data.OleDb Namespace OleDbConnection Class Opens a database connection with the property settings specified by the ConnectionString. [ VB ] NotOverridable Public Sub Open ( ) [ C# ] public void Open ( ); [ C++ ] public: __sealed void Open ( ); [ C++ ] public function Open ( ); Exceptions
RemarksThe OleDbConnection draws an open connection from the connection pool if one is available. Otherwise, it establishes a new connection to the data source.
ExampleThe following example initializes and opens an OleDbConnection, displays some of its properties, then closes the connection. protected void Page_Load ( Object Src, EventArgs e ) {
// specify the data source
OleDbConnection myConn = new OleDbConnection (
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" +
Server.MapPath ( "~/app_data/pubs.mdb" ) );
// open the data connection
myConn.Open ( );
// retrieve properties of the connection object
...
// close the data connection
myConn.Close ( );
}
See AlsoOleDbConnection Members Close StateChange |
| ||||||
Check out related books at Amazon
© 2000-2008 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 aspxtreme