--- title: "Connection (ADO - WFC Syntax) | Microsoft Docs" ms.prod: sql ms.prod_service: connectivity ms.technology: connectivity ms.custom: "" ms.date: "01/19/2017" ms.reviewer: "" ms.topic: conceptual apitype: "COM" helpviewer_keywords: - "Connection collection [ADO], ADO/WFC syntax" ms.assetid: 8cfc35bb-91e2-47da-ad4c-982e9162cd51 author: MightyPen ms.author: genemi --- # Connection (ADO - WFC Syntax) ## package com.ms.wfc.data ### Constructor ``` public Connection() public Connection(String connectionstring) ``` ### Methods ``` public int beginTrans() public void commitTrans() public void rollbackTrans() public void cancel() public void close() public com.ms.wfc.data.Recordset execute(String commandText) public com.ms.wfc.data.Recordset execute(String commandText, int options) public int executeUpdate(String commandText) public int executeUpdate(String commandText, int options) ``` The **executeUpdate** method is a special case method that calls the underlying ADO **execute** method with certain parameters. The **executeUpdate** method does not support the return of a **Recordset** object, so the **execute** method's *options* parameter is modified with **AdoEnums.ExecuteOptions.NORECORDS**. After the **execute** method completes, its updated *RecordsAffected* parameter is passed back to the **executeUpdate** method, which is finally returned as an **int**. ``` public void open() public void open(String connectionString) public void open(String connectionString, String userID) public void open(String connectionString, String userID, String password) public void open(String connectionString, String userID, String password, int options) public Recordset openSchema(int schema, Object[] restrictions, String schemaID) public Recordset openSchema(int schema) public Recordset openSchema(int schema, Object[] restrictions) ``` ### Properties ``` public int getAttributes() public void setAttributes(int attr) public int getCommandTimeout() public void setCommandTimeout(int timeout) public String getConnectionString() public void setConnectionString(String con) public int getConnectionTimeout() public void setConnectionTimeout(int timeout) public int getCursorLocation() public void setCursorLocation(int cursorLoc) public String getDefaultDatabase() public void setDefaultDatabase(String db) public int getIsolationLevel() public void setIsolationLevel(int level) public int getMode() public void setMode(int mode) public String getProvider() public void setProvider(String provider) public int getState() public String getVersion() public AdoProperties getProperties() public com.ms.wfc.data.Errors getErrors() ``` ### Events For more information about ADO/WFC events, see [ADO Event Instantiation by Language](../../../ado/guide/data/ado-event-instantiation-by-language.md). ``` public void addOnBeginTransComplete(ConnectionEventHandler handler) public void removeOnBeginTransComplete(ConnectionEventHandler handler) public void addOnCommitTransComplete(ConnectionEventHandler handler) public void removeOnCommitTransComplete(ConnectionEventHandler handler) public void addOnConnectComplete(ConnectionEventHandler handler) public void removeOnConnectComplete(ConnectionEventHandler handler) public void addOnDisconnect(ConnectionEventHandler handler) public void removeOnDisconnect(ConnectionEventHandler handler) public void addOnExecuteComplete(ConnectionEventHandler handler) public void removeOnExecuteComplete(ConnectionEventHandler handler) public void addOnInfoMessage(ConnectionEventHandler handler) public void removeOnInfoMessage(ConnectionEventHandler handler) public void addOnRollbackTransComplete(ConnectionEventHandler handler) public void removeOnRollbackTransComplete(ConnectionEventHandler handler) public void addOnWillConnect(ConnectionEventHandler handler) public void removeOnWillConnect(ConnectionEventHandler handler) public void addOnWillExecute(ConnectionEventHandler handler) public void removeOnWillExecute(ConnectionEventHandler handler) ``` ## See Also [Connection Object (ADO)](../../../ado/reference/ado-api/connection-object-ado.md)