SqlMetaData Constructor (String, SqlDbType, Int64, Int64, SqlCompareOptions)
Initializes a new instance of the SqlMetaData class with the specified column name, type, maximum length, locale, and compare options.
Assembly: System.Data (in System.Data.dll)
public: SqlMetaData( String^ name, SqlDbType dbType, long long maxLength, long long locale, SqlCompareOptions compareOptions )
Parameters
- name
- Type: System::String
The name of the parameter or column.
- dbType
- Type: System.Data::SqlDbType
The SQL Server type of the parameter or column.
- maxLength
- Type: System::Int64
The maximum length of the specified type.
- locale
- Type: System::Int64
The locale ID of the parameter or column.
- compareOptions
- Type: System.Data.SqlTypes::SqlCompareOptions
The comparison rules of the parameter or column.
| Exception | Condition |
|---|---|
| ArgumentNullException | The Name is nullptr. |
| ArgumentException | A SqlDbType that is not allowed was passed to the constructor as dbType. |
Only the following are allowed to be passed to the constructor as dbType: Char, NChar, Ntext, NVarChar, Text, VarChar.
Only a maxLength specification of Max, or -1, is allowed for a dbType of Text or NText.
For a dbType of Varchar or Nvarchar, a length specification of Max, or -1, declares the metadata as varchar(max) and nvarchar(max), respectively.
The following are the default values assigned to dbType, depending on the SqlDbType (the XmlSchemaCollectionDatabase, XmlSchemaCollectionName, XmlSchemaCollectionOwningSchema, and Type properties are set to nullptr):
SqlDbType | Precision | Scale |
|---|---|---|
Char | 0 | 0 |
NChar | 0 | 0 |
NText | 0 | 0 |
NVarChar | 0 | 0 |
Text | 0 | 0 |
VarChar | 0 | 0 |
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.