Export (0) Print
Expand All

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.

Namespace:  Microsoft.SqlServer.Server
Assembly:  System.Data (in System.Data.dll)

public SqlMetaData(
	string name,
	SqlDbType dbType,
	long maxLength,
	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.

ExceptionCondition
ArgumentNullException

The Name is null.

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 null):

SqlDbType

Precision

Scale

Char

0

0

NChar

0

0

NText

0

0

NVarChar

0

0

Text

0

0

VarChar

0

0

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft