DataCommand Class

Provides the ability to build and execute data commands of various types against data sources, and to retrieve read-only results or a command status code.

Namespace:  Microsoft.VisualStudio.Data.Framework
Assembly:  Microsoft.VisualStudio.Data.Framework (in Microsoft.VisualStudio.Data.Framework.dll)

Syntax

'Declaration
Public MustInherit Class DataCommand _
    Inherits DataSiteableObject(Of IVsDataConnection) _
    Implements IVsDataCommand
'Usage
Dim instance As DataCommand
public abstract class DataCommand : DataSiteableObject<IVsDataConnection>, 
    IVsDataCommand
public ref class DataCommand abstract : public DataSiteableObject<IVsDataConnection^>, 
    IVsDataCommand
public abstract class DataCommand extends DataSiteableObject<IVsDataConnection> implements IVsDataCommand

Remarks

Data Designer Extensibility (DDEX) providers can execute various types of commands against a data source. This may include, but is not limited to, SQL statements, procedures, and function calls. They may also expose the ability to prepare and derive parameters and schemas for commands.

The DataCommand class introduces command types. A command type indicates a programmatic interpretation of a given command string. For example, a command type Text might notify the DDEX provider that the command string is a SQL statement that should be executed directly. Alternatively, a TabularFunction command type might notify the DDEX provider that the command string is the name of a table-valued function that should be executed by using the appropriate method.

Underlying technologies such as Open Database Connectivity (ODBC), OLE DB, and ADO.NET attempt to enumerate a set of allowed command types, typically as plain text, in table form, or as stored procedures. The DataCommand class extends this concept by relaxing the requirement that such a command type originate in a fixed enumeration. This provides flexibility by enabling DDEX providers to add custom command types, along with descriptions of how and when the commands can be used.

Note

To provide command execution capability asynchronously, use the DataAsyncCommand class. This class has a set of methods that are equivalent to those on the DataCommand class, but these methods operate asynchronously.

Notes to Inheritors:

When you inherit from the DataCommand class, you must override each method from this class that is to be supported by its DDEX provider implementation. The base implementation of each method in this class throws a NotSupportedException.

Note that the ExecuteWithoutResults method has a base implementation that delegates to the Execute method.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Data.Framework.DataSiteableObject<IVsDataConnection>
    Microsoft.VisualStudio.Data.Framework.DataCommand

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

DataCommand Members

Microsoft.VisualStudio.Data.Framework Namespace

DataCommandType