Udostępnij za pośrednictwem


DataCommand.Prepare(String, Int32, Int32) Method

Definition

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

public:
 virtual System::String ^ Prepare(System::String ^ command, int commandType, int commandTimeout);
public virtual string Prepare (string command, int commandType, int commandTimeout);
abstract member Prepare : string * int * int -> string
override this.Prepare : string * int * int -> string
Public Overridable Function Prepare (command As String, commandType As Integer, commandTimeout As Integer) As String

Parameters

command
String

A command to execute that is specific to a data source.

commandType
Int32

The command type for the indicated command, specifying how to interpret the contents of the command parameter.

commandTimeout
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.

Returns

Returns an identifier of the prepared command that can later be passed to the Execute(String, Int32, DataParameter[], Int32) or ExecuteWithoutResults(String, Int32, DataParameter[], Int32) methods using the command type Prepared.

Exceptions

The command or asyncCommandEvents are null.

The commandType specifies an invalid type.

The commandTimeout is less than -1.

The provider does not support this method.

Applies to