DataCommand.DeriveSchema Method (String, DataCommandType, array<IVsDataParameter , Int32)
Derives the schema returned from a specified command. The schema indicates the layout of items and blocks in a data reader.
Namespace: Microsoft.VisualStudio.Data.Framework
Assembly: Microsoft.VisualStudio.Data.Framework (in Microsoft.VisualStudio.Data.Framework.dll)
Syntax
'Declaration
Public Overridable Function DeriveSchema ( _
command As String, _
commandType As DataCommandType, _
parameters As IVsDataParameter(), _
commandTimeout As Integer _
) As IVsDataReader
public virtual IVsDataReader DeriveSchema(
string command,
DataCommandType commandType,
IVsDataParameter[] parameters,
int commandTimeout
)
public:
virtual IVsDataReader^ DeriveSchema(
String^ command,
DataCommandType commandType,
array<IVsDataParameter^>^ parameters,
int commandTimeout
)
abstract DeriveSchema :
command:string *
commandType:DataCommandType *
parameters:IVsDataParameter[] *
commandTimeout:int -> IVsDataReader
override DeriveSchema :
command:string *
commandType:DataCommandType *
parameters:IVsDataParameter[] *
commandTimeout:int -> IVsDataReader
public function DeriveSchema(
command : String,
commandType : DataCommandType,
parameters : IVsDataParameter[],
commandTimeout : int
) : IVsDataReader
Parameters
- command
Type: System.String
A command for which to derive the schema specific to a data source.
- commandType
Type: Microsoft.VisualStudio.Data.Services.SupportEntities.DataCommandType
The type of the command that specifies how to interpret the contents of the command parameter. The command type could either be a value from the DataCommandType enumeration or a custom command type defined by a provider, which can be passed in by forcing a cast from an integer to the DataCommandType enumeration.
- parameters
Type: array<Microsoft.VisualStudio.Data.Services.SupportEntities.IVsDataParameter[]
An array of IVsDataParameter objects representing the command parameters for the specified command type.
- commandTimeout
Type: System.Int32
The length of time, in seconds, to block the client before canceling the schema derivation and returning to the caller. A value of 0 indicates infinite time-out; a value of -1 indicates a provider default.
Return Value
Type: Microsoft.VisualStudio.Data.Services.SupportEntities.IVsDataReader
An IVsDataReader object. This object provides a forward-only, read-only data stream that describes the layout of items and blocks, that is, the schema, for the reader object returned upon executing the specified command.
Implements
IVsDataCommand.DeriveSchema(String, DataCommandType, array<IVsDataParameter[], Int32)
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | The command parameter is nulla null reference (Nothing in Visual Basic). |
ArgumentOutOfRangeException | The commandTimeout parameter is less than -1. |
Remarks
The schema of the data reader returned by this method must follow a specific format. For each result that will be returned when you execute the command, there should be a result in the data reader. Each of these results should contain blocks that describe the items that will be returned when you execute the command. The description should contain the following items:
Name (String): the name of the item.
Ordinal (Int32): the position of the item.
UserDataType (String): the user data type of the item (for example, "myType").
NativeDataType (String): the native data type of the item (for example, "nvarchar").
ProviderDataType (Int32): the provider data type of the item (for example, System.Data.SqlDbType.NVarChar).
ProviderDbType (Int32): the generic ADO.NET data type of the item (for example, System.Data.DbType.StringFixedLength).
FrameworkDataType (Type): the framework data type of the item (for example, System.Int32).
Length (Int32): the maximum length of the item, if applicable.
Precision (Int32): the precision of the item, if applicable.
Scale (Int32): the scale of the item, if applicable.
Nullable (Boolean): the nullability of the item.
Those items that a provider does not support (for example, some forms of the data type) should be present but set to nulla null reference (Nothing in Visual Basic).
Hinweis
Other exceptions that occur indicate that the schema derivation failed for a provider-specified reason.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.