Share via


DataCommand.Prepare Method

Prepares the specified command on the data source to be executed; the command may then be executed multiple times, with varying parameters.

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

Syntax

'Declaration
Public Overridable Function Prepare ( _
    command As String, _
    commandType As Integer, _
    commandTimeout As Integer _
) As String
public virtual string Prepare(
    string command,
    int commandType,
    int commandTimeout
)
public:
virtual String^ Prepare(
    String^ command, 
    int commandType, 
    int commandTimeout
)
abstract Prepare : 
        command:string * 
        commandType:int * 
        commandTimeout:int -> string 
override Prepare : 
        command:string * 
        commandType:int * 
        commandTimeout:int -> string 
public function Prepare(
    command : String, 
    commandType : int, 
    commandTimeout : int
) : String

Parameters

  • command
    Type: System.String
    A command to execute that is specific to a data source.
  • commandType
    Type: System.Int32
    The command type for the indicated command, specifying how to interpret the contents of the command parameter.
  • commandTimeout
    Type: System.Int32
    The length of time, in seconds, to block the client before canceling the execution and returning to the caller. A value of 0 indicates infinite timeout; a value of -1 indicates a provider default.

Return Value

Type: System.String
Returns an identifier of the prepared command that can later be passed to the Execute or ExecuteWithoutResults methods using the command type Prepared.

Exceptions

Exception Condition
ArgumentNullException

The command or asyncCommandEvents are null.

ArgumentException

The commandType specifies an invalid type.

ArgumentOutOfRangeException

The commandTimeout is less than -1.

NotSupportedException

The provider does not support this method.

Remarks

Other exceptions that occur indicate that the parameter derivation failed for a provider-specified reason.

.NET Framework Security

See Also

Reference

DataCommand Class

Microsoft.VisualStudio.Data Namespace

DataCommand