SqlMetaData 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
SqlMetaData(String, SqlDbType)
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
使用指定的列名称和类型初始化类的新实例 SqlMetaData 。
public:
SqlMetaData(System::String ^ name, System::Data::SqlDbType dbType);
public SqlMetaData(string name, System.Data.SqlDbType dbType);
new Microsoft.Data.SqlClient.Server.SqlMetaData : string * System.Data.SqlDbType -> Microsoft.Data.SqlClient.Server.SqlMetaData
Public Sub New (name As String, dbType As SqlDbType)
参数
- name
- String
列的名称。
- dbType
- SqlDbType
参数或列的SQL Server类型。
例外
name 是 null。
不允许的项 SqlDbType 作为传递给构造函数 dbType。
示例
以下示例通过指定列名和列数据类型创建一个新 SqlMetaData 对象 Int
using Microsoft.Data.SqlClient.Server;
public static void CreateSqlMetaData2()
{
SqlMetaData columnInfo;
columnInfo = new SqlMetaData("Column2", SqlDbType.Int);
}
注解
仅允许将以下项传递给此构造函数:dbTypeBit、DecimalDateTimeBigInt、FloatNumericMoneyInt、、、 。 XmlUniqueIdentifierSmallDateTimeSmallIntSmallMoneyTimestampTinyInt
以下是分配给
| SqlDbType | 最大长度 | 精准率 | 比例尺/规模 | Locale | 比较选项 |
|---|---|---|---|---|---|
| Bit | 1 | 1 | 0 | 0 | 没有 |
| BigInt | 8 | 19 | 0 | 0 | 没有 |
| DateTime | 8 | 23 | 3 | 0 | 没有 |
| Decimal | 9 | 18 | 0 | 0 | 没有 |
| Float | 8 | 53 | 0 | 0 | 没有 |
| Int | 4 | 10 | 0 | 0 | 没有 |
| Money | 8 | 19 | 4 | 0 | 没有 |
Numeric | 9 | 18 | 0 | 0 | 没有 |
| SmallDateTime | 4 | 16 | 0 | 0 | 没有 |
| SmallInt | 2 | 5 | 0 | 0 | 没有 |
| SmallMoney | 4 | 10 | 4 | 0 | 没有 |
| Timestamp | 8 | 0 | 0 | 0 | 没有 |
| TinyInt | 1 | 3 | 0 | 0 | 没有 |
| UniqueIdentifier | 16 | 0 | 0 | 0 | 没有 |
| Xml | Max (-1) | 0 | 0 | 0 | IgnoreCase、IgnoreKanaType、IgnoreWidth |
适用于
SqlMetaData(String, SqlDbType, Int64, Byte, Byte, Int64, SqlCompareOptions, Type, Boolean, Boolean, SortOrder, Int32)
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
使用指定的列名、类型、最大长度、精度、刻度、区域设置 ID、比较选项和用户定义的类型(UDT)初始化类的新实例 SqlMetaData 。 这种形式的构造函数支持表值参数,即允许指定列在表值参数中是否唯一、该列的排序顺序以及排序列的序号。
public:
SqlMetaData(System::String ^ name, System::Data::SqlDbType dbType, long maxLength, System::Byte precision, System::Byte scale, long localeId, System::Data::SqlTypes::SqlCompareOptions compareOptions, Type ^ userDefinedType, bool useServerDefault, bool isUniqueKey, Microsoft::Data::SqlClient::SortOrder columnSortOrder, int sortOrdinal);
public SqlMetaData(string name, System.Data.SqlDbType dbType, long maxLength, byte precision, byte scale, long localeId, System.Data.SqlTypes.SqlCompareOptions compareOptions, Type userDefinedType, bool useServerDefault, bool isUniqueKey, Microsoft.Data.SqlClient.SortOrder columnSortOrder, int sortOrdinal);
new Microsoft.Data.SqlClient.Server.SqlMetaData : string * System.Data.SqlDbType * int64 * byte * byte * int64 * System.Data.SqlTypes.SqlCompareOptions * Type * bool * bool * Microsoft.Data.SqlClient.SortOrder * int -> Microsoft.Data.SqlClient.Server.SqlMetaData
Public Sub New (name As String, dbType As SqlDbType, maxLength As Long, precision As Byte, scale As Byte, localeId As Long, compareOptions As SqlCompareOptions, userDefinedType As Type, useServerDefault As Boolean, isUniqueKey As Boolean, columnSortOrder As SortOrder, sortOrdinal As Integer)
参数
- name
- String
列的名称。
- dbType
- SqlDbType
参数或列的SQL Server类型。
- maxLength
- Int64
指定类型的最大长度。
- precision
- Byte
参数或列的精度。
- scale
- Byte
参数或列的刻度。
- localeId
- Int64
参数或列的区域设置 ID。
- compareOptions
- SqlCompareOptions
参数或列的比较规则。
- useServerDefault
- Boolean
指定此列是否应使用默认服务器值。
- isUniqueKey
- Boolean
指定表值参数中的列是否唯一。
- columnSortOrder
- SortOrder
指定列的排序顺序。
- sortOrdinal
- Int32
指定排序列的序号。
注解
有关详细信息,请参阅 Table-Valued 参数。
适用于
SqlMetaData(String, SqlDbType, String, String, String, Boolean, Boolean, SortOrder, Int32)
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
使用指定的列名、数据库名称、拥有架构、对象名称和默认服务器初始化类的新实例 SqlMetaData 。 这种形式的构造函数支持表值参数,即允许指定列在表值参数中是否唯一、该列的排序顺序以及排序列的序号。
public:
SqlMetaData(System::String ^ name, System::Data::SqlDbType dbType, System::String ^ database, System::String ^ owningSchema, System::String ^ objectName, bool useServerDefault, bool isUniqueKey, Microsoft::Data::SqlClient::SortOrder columnSortOrder, int sortOrdinal);
public SqlMetaData(string name, System.Data.SqlDbType dbType, string database, string owningSchema, string objectName, bool useServerDefault, bool isUniqueKey, Microsoft.Data.SqlClient.SortOrder columnSortOrder, int sortOrdinal);
new Microsoft.Data.SqlClient.Server.SqlMetaData : string * System.Data.SqlDbType * string * string * string * bool * bool * Microsoft.Data.SqlClient.SortOrder * int -> Microsoft.Data.SqlClient.Server.SqlMetaData
Public Sub New (name As String, dbType As SqlDbType, database As String, owningSchema As String, objectName As String, useServerDefault As Boolean, isUniqueKey As Boolean, columnSortOrder As SortOrder, sortOrdinal As Integer)
参数
- name
- String
列的名称。
- dbType
- SqlDbType
参数或列的SQL Server类型。
- database
- String
类型化的 XML 实例的 XML 架构集合的数据库名称。
- owningSchema
- String
类型化的 XML 实例的 XML 架构集合的关系架构名称。
- objectName
- String
类型化的 XML 实例的 XML 架构集合的名称。
- useServerDefault
- Boolean
指定此列是否应使用默认服务器值。
- isUniqueKey
- Boolean
指定表值参数中的列是否唯一。
- columnSortOrder
- SortOrder
指定列的排序顺序。
- sortOrdinal
- Int32
指定排序列的序号。
注解
有关详细信息,请参阅 Table-Valued 参数。
适用于
SqlMetaData(String, SqlDbType, Int64, Int64, SqlCompareOptions, Boolean, Boolean, SortOrder, Int32)
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
使用指定的列名称、类型、最大长度、区域设置、比较选项和服务器默认值初始化类的新实例 SqlMetaData 。 这种形式的构造函数支持表值参数,即允许指定列在表值参数中是否唯一、该列的排序顺序以及排序列的序号。
public:
SqlMetaData(System::String ^ name, System::Data::SqlDbType dbType, long maxLength, long locale, System::Data::SqlTypes::SqlCompareOptions compareOptions, bool useServerDefault, bool isUniqueKey, Microsoft::Data::SqlClient::SortOrder columnSortOrder, int sortOrdinal);
public SqlMetaData(string name, System.Data.SqlDbType dbType, long maxLength, long locale, System.Data.SqlTypes.SqlCompareOptions compareOptions, bool useServerDefault, bool isUniqueKey, Microsoft.Data.SqlClient.SortOrder columnSortOrder, int sortOrdinal);
new Microsoft.Data.SqlClient.Server.SqlMetaData : string * System.Data.SqlDbType * int64 * int64 * System.Data.SqlTypes.SqlCompareOptions * bool * bool * Microsoft.Data.SqlClient.SortOrder * int -> Microsoft.Data.SqlClient.Server.SqlMetaData
Public Sub New (name As String, dbType As SqlDbType, maxLength As Long, locale As Long, compareOptions As SqlCompareOptions, useServerDefault As Boolean, isUniqueKey As Boolean, columnSortOrder As SortOrder, sortOrdinal As Integer)
参数
- name
- String
列的名称。
- dbType
- SqlDbType
参数或列的SQL Server类型。
- maxLength
- Int64
指定类型的最大长度。
- locale
- Int64
参数或列的区域设置 ID。
- compareOptions
- SqlCompareOptions
参数或列的比较规则。
- useServerDefault
- Boolean
指定此列是否应使用默认服务器值。
- isUniqueKey
- Boolean
指定表值参数中的列是否唯一。
- columnSortOrder
- SortOrder
指定列的排序顺序。
- sortOrdinal
- Int32
指定排序列的序号。
注解
有关详细信息,请参阅 Table-Valued 参数。
适用于
SqlMetaData(String, SqlDbType, Type, String, Boolean, Boolean, SortOrder, Int32)
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
使用指定的列名、类型、用户定义类型、SQL Server类型和服务器默认值初始化类的新实例SqlMetaData。 这种形式的构造函数支持表值参数,即允许指定列在表值参数中是否唯一、该列的排序顺序以及排序列的序号。
public:
SqlMetaData(System::String ^ name, System::Data::SqlDbType dbType, Type ^ userDefinedType, System::String ^ serverTypeName, bool useServerDefault, bool isUniqueKey, Microsoft::Data::SqlClient::SortOrder columnSortOrder, int sortOrdinal);
public SqlMetaData(string name, System.Data.SqlDbType dbType, Type userDefinedType, string serverTypeName, bool useServerDefault, bool isUniqueKey, Microsoft.Data.SqlClient.SortOrder columnSortOrder, int sortOrdinal);
new Microsoft.Data.SqlClient.Server.SqlMetaData : string * System.Data.SqlDbType * Type * string * bool * bool * Microsoft.Data.SqlClient.SortOrder * int -> Microsoft.Data.SqlClient.Server.SqlMetaData
Public Sub New (name As String, dbType As SqlDbType, userDefinedType As Type, serverTypeName As String, useServerDefault As Boolean, isUniqueKey As Boolean, columnSortOrder As SortOrder, sortOrdinal As Integer)
参数
- name
- String
列的名称。
- dbType
- SqlDbType
参数或列的SQL Server类型。
- serverTypeName
- String
SQL Server类型userDefinedType名称。
- useServerDefault
- Boolean
指定此列是否应使用默认服务器值。
- isUniqueKey
- Boolean
指定表值参数中的列是否唯一。
- columnSortOrder
- SortOrder
指定列的排序顺序。
- sortOrdinal
- Int32
指定排序列的序号。
注解
有关详细信息,请参阅 Table-Valued 参数。
适用于
SqlMetaData(String, SqlDbType, Byte, Byte, Boolean, Boolean, SortOrder, Int32)
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
使用指定的列名、类型、精度、小数位数和服务器默认值初始化类的新实例 SqlMetaData 。 这种形式的构造函数支持表值参数,即允许指定列在表值参数中是否唯一、该列的排序顺序以及排序列的序号。
public:
SqlMetaData(System::String ^ name, System::Data::SqlDbType dbType, System::Byte precision, System::Byte scale, bool useServerDefault, bool isUniqueKey, Microsoft::Data::SqlClient::SortOrder columnSortOrder, int sortOrdinal);
public SqlMetaData(string name, System.Data.SqlDbType dbType, byte precision, byte scale, bool useServerDefault, bool isUniqueKey, Microsoft.Data.SqlClient.SortOrder columnSortOrder, int sortOrdinal);
new Microsoft.Data.SqlClient.Server.SqlMetaData : string * System.Data.SqlDbType * byte * byte * bool * bool * Microsoft.Data.SqlClient.SortOrder * int -> Microsoft.Data.SqlClient.Server.SqlMetaData
Public Sub New (name As String, dbType As SqlDbType, precision As Byte, scale As Byte, useServerDefault As Boolean, isUniqueKey As Boolean, columnSortOrder As SortOrder, sortOrdinal As Integer)
参数
- name
- String
列的名称。
- dbType
- SqlDbType
参数或列的SQL Server类型。
- precision
- Byte
参数或列的精度。
- scale
- Byte
参数或列的刻度。
- useServerDefault
- Boolean
指定此列是否应使用默认服务器值。
- isUniqueKey
- Boolean
指定表值参数中的列是否唯一。
- columnSortOrder
- SortOrder
指定列的排序顺序。
- sortOrdinal
- Int32
指定排序列的序号。
注解
有关详细信息,请参阅 Table-Valued 参数。
适用于
SqlMetaData(String, SqlDbType, Int64, Boolean, Boolean, SortOrder, Int32)
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
使用指定的列名称、类型、最大长度和服务器默认值初始化类的新实例 SqlMetaData 。 这种形式的构造函数支持表值参数,即允许指定列在表值参数中是否唯一、该列的排序顺序以及排序列的序号。
public:
SqlMetaData(System::String ^ name, System::Data::SqlDbType dbType, long maxLength, bool useServerDefault, bool isUniqueKey, Microsoft::Data::SqlClient::SortOrder columnSortOrder, int sortOrdinal);
public SqlMetaData(string name, System.Data.SqlDbType dbType, long maxLength, bool useServerDefault, bool isUniqueKey, Microsoft.Data.SqlClient.SortOrder columnSortOrder, int sortOrdinal);
new Microsoft.Data.SqlClient.Server.SqlMetaData : string * System.Data.SqlDbType * int64 * bool * bool * Microsoft.Data.SqlClient.SortOrder * int -> Microsoft.Data.SqlClient.Server.SqlMetaData
Public Sub New (name As String, dbType As SqlDbType, maxLength As Long, useServerDefault As Boolean, isUniqueKey As Boolean, columnSortOrder As SortOrder, sortOrdinal As Integer)
参数
- name
- String
列的名称。
- dbType
- SqlDbType
参数或列的SQL Server类型。
- maxLength
- Int64
指定类型的最大长度。
- useServerDefault
- Boolean
指定此列是否应使用默认服务器值。
- isUniqueKey
- Boolean
指定表值参数中的列是否唯一。
- columnSortOrder
- SortOrder
指定列的排序顺序。
- sortOrdinal
- Int32
指定排序列的序号。
注解
有关详细信息,请参阅 Table-Valued 参数。
适用于
SqlMetaData(String, SqlDbType, Int64, Byte, Byte, Int64, SqlCompareOptions, Type)
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
使用指定的列名、类型、最大长度、精度、刻度、区域设置 ID、比较选项和用户定义的类型(UDT)初始化类的新实例 SqlMetaData 。
public:
SqlMetaData(System::String ^ name, System::Data::SqlDbType dbType, long maxLength, System::Byte precision, System::Byte scale, long locale, System::Data::SqlTypes::SqlCompareOptions compareOptions, Type ^ userDefinedType);
public SqlMetaData(string name, System.Data.SqlDbType dbType, long maxLength, byte precision, byte scale, long locale, System.Data.SqlTypes.SqlCompareOptions compareOptions, Type userDefinedType);
new Microsoft.Data.SqlClient.Server.SqlMetaData : string * System.Data.SqlDbType * int64 * byte * byte * int64 * System.Data.SqlTypes.SqlCompareOptions * Type -> Microsoft.Data.SqlClient.Server.SqlMetaData
Public Sub New (name As String, dbType As SqlDbType, maxLength As Long, precision As Byte, scale As Byte, locale As Long, compareOptions As SqlCompareOptions, userDefinedType As Type)
参数
- name
- String
列的名称。
- dbType
- SqlDbType
参数或列的SQL Server类型。
- maxLength
- Int64
指定类型的最大长度。
- precision
- Byte
参数或列的精度。
- scale
- Byte
参数或列的刻度。
- locale
- Int64
参数或列的区域设置 ID。
- compareOptions
- SqlCompareOptions
参数或列的比较规则。
例外
name 是 null。
不允许的项 SqlDbType 将传递给构造函数 dbType,或 userDefinedType 指向未 SqlUserDefinedTypeAttribute 声明的类型。
注解
仅允许将以下项传递给构造函数:dbTypeBigInt、、、BitDateTime、FloatDecimal、RealIntNumericImageSmallDateTimeNTextMoneyTimestampTextSmallIntSmallMoneyTinyInt、Udt、。 UniqueIdentifierVariantXml
以下是分配给
| SqlDbType | 最大长度 | 精准率 | 比例尺/规模 | Locale | 比较选项 |
|---|---|---|---|---|---|
| BigInt | 8 | 19 | 0 | 0 | 没有 |
| Bit | 1 | 1 | 0 | 0 | 没有 |
| DateTime | 8 | 23 | 3 | 0 | 没有 |
| Decimal | 9 | 18 | 0 | 0 | 没有 |
| Float | 8 | 53 | 0 | 0 | 没有 |
| Image | Max (-1) | 0 | 0 | 0 | 没有 |
| Int | 4 | 10 | 0 | 0 | 没有 |
| Money | 8 | 19 | 4 | 0 | 没有 |
| NText | Max (-1) | 0 | 0 | <thread> | IgnoreCase、IgnoreKanaType、IgnoreWidth |
| Real | 4 | 24 | 0 | 0 | 没有 |
Row | <列数> | 0 | 0 | 0 | 没有 |
| SmallDateTime | 4 | 16 | 0 | 0 | 没有 |
| SmallInt | 2 | 5 | 0 | 0 | 没有 |
| SmallMoney | 4 | 10 | 4 | 0 | 没有 |
| Text | Max (-1) | 0 | 0 | <thread> | IgnoreCase、IgnoreKanaType、IgnoreWidth |
| Timestamp | 8 | 0 | 0 | 0 | 没有 |
| TinyInt | 1 | 3 | 0 | 0 | 没有 |
| UniqueIdentifier | 16 | 0 | 0 | 0 | 没有 |
| Udt | <类型> 或 -1 的最大长度 | 0 | 0 | 0 | 没有 |
| Variant | 8016 | 0 | 0 | 0 | 没有 |
| Xml | Max (-1) | 0 | 0 | 0 | IgnoreCase、IgnoreKanaType、IgnoreWidth |
适用于
SqlMetaData(String, SqlDbType, String, String, String)
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
使用指定的列名称、类型、数据库名称、拥有架构和对象名称初始化类的新实例 SqlMetaData 。
public:
SqlMetaData(System::String ^ name, System::Data::SqlDbType dbType, System::String ^ database, System::String ^ owningSchema, System::String ^ objectName);
public SqlMetaData(string name, System.Data.SqlDbType dbType, string database, string owningSchema, string objectName);
new Microsoft.Data.SqlClient.Server.SqlMetaData : string * System.Data.SqlDbType * string * string * string -> Microsoft.Data.SqlClient.Server.SqlMetaData
Public Sub New (name As String, dbType As SqlDbType, database As String, owningSchema As String, objectName As String)
参数
- name
- String
列的名称。
- dbType
- SqlDbType
参数或列的SQL Server类型。
- database
- String
类型化的 XML 实例的 XML 架构集合的数据库名称。
- owningSchema
- String
类型化的 XML 实例的 XML 架构集合的关系架构名称。
- objectName
- String
类型化的 XML 实例的 XML 架构集合的名称。
例外
是name,或objectName是null何时database和非owningSchemanull。null
不允许的 SqlDbType 将传递给构造函数。dbType
注解
仅允许将以下内容SqlDbType传递给构造函数:dbType. Xml
以下是分配给 dbType的默认值,具体取决于 SqlDbType:
| SqlDbType | 最大长度 | 精准率 | 比例尺/规模 | Locale | 比较选项 |
|---|---|---|---|---|---|
| Xml | Max (-1) | 0 | 0 | 0 | IgnoreCase、IgnoreKanaType、IgnoreWidth |
适用于
SqlMetaData(String, SqlDbType, Int64, Int64, SqlCompareOptions)
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
使用指定的列名称、类型、最大长度、区域设置和比较选项初始化类的新实例 SqlMetaData 。
public:
SqlMetaData(System::String ^ name, System::Data::SqlDbType dbType, long maxLength, long locale, System::Data::SqlTypes::SqlCompareOptions compareOptions);
public SqlMetaData(string name, System.Data.SqlDbType dbType, long maxLength, long locale, System.Data.SqlTypes.SqlCompareOptions compareOptions);
new Microsoft.Data.SqlClient.Server.SqlMetaData : string * System.Data.SqlDbType * int64 * int64 * System.Data.SqlTypes.SqlCompareOptions -> Microsoft.Data.SqlClient.Server.SqlMetaData
Public Sub New (name As String, dbType As SqlDbType, maxLength As Long, locale As Long, compareOptions As SqlCompareOptions)
参数
- name
- String
参数或列的名称。
- dbType
- SqlDbType
参数或列的SQL Server类型。
- maxLength
- Int64
指定类型的最大长度。
- locale
- Int64
参数或列的区域设置 ID。
- compareOptions
- SqlCompareOptions
参数或列的比较规则。
例外
name 是 null。
不允许的项 SqlDbType 作为传递给构造函数 dbType。
注解
仅允许将以下内容传递给构造函数:dbType、、NChar、NVarCharNText、Text。 VarCharChar
仅允许NTextTextdbType或 maxLength -1 的Max规范。
dbType
VarChar对于或 NVarChar-1 的长度规范Max,分别将元数据声明为 VARCHAR(MAX) 和 NVARCHAR(MAX)。
以下是分配给
| SqlDbType | 精准率 | 比例尺/规模 |
|---|---|---|
| Char | 0 | 0 |
| NChar | 0 | 0 |
| NText | 0 | 0 |
| NVarChar | 0 | 0 |
| Text | 0 | 0 |
| VarChar | 0 | 0 |
适用于
SqlMetaData(String, SqlDbType, Type, String)
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
使用指定的列名、用户定义的类型(UDT)和SQL Server类型初始化类的新实例SqlMetaData。
public:
SqlMetaData(System::String ^ name, System::Data::SqlDbType dbType, Type ^ userDefinedType, System::String ^ serverTypeName);
public SqlMetaData(string name, System.Data.SqlDbType dbType, Type userDefinedType, string serverTypeName);
new Microsoft.Data.SqlClient.Server.SqlMetaData : string * System.Data.SqlDbType * Type * string -> Microsoft.Data.SqlClient.Server.SqlMetaData
Public Sub New (name As String, dbType As SqlDbType, userDefinedType As Type, serverTypeName As String)
参数
- name
- String
列的名称。
- dbType
- SqlDbType
参数或列的SQL Server类型。
- serverTypeName
- String
SQL Server类型userDefinedType名称。
适用于
SqlMetaData(String, SqlDbType, Byte, Byte)
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
使用指定的列名、类型、精度和小数位数初始化类的新实例 SqlMetaData 。
public:
SqlMetaData(System::String ^ name, System::Data::SqlDbType dbType, System::Byte precision, System::Byte scale);
public SqlMetaData(string name, System.Data.SqlDbType dbType, byte precision, byte scale);
new Microsoft.Data.SqlClient.Server.SqlMetaData : string * System.Data.SqlDbType * byte * byte -> Microsoft.Data.SqlClient.Server.SqlMetaData
Public Sub New (name As String, dbType As SqlDbType, precision As Byte, scale As Byte)
参数
- name
- String
参数或列的名称。
- dbType
- SqlDbType
参数或列的SQL Server类型。
- precision
- Byte
参数或列的精度。
- scale
- Byte
参数或列的刻度。
例外
name 是 null。
不允许的项SqlDbType作为或scale大于precision传递给构造函数dbType。
注解
仅允许将以下内容SqlDbType传递给构造函数:dbType. Decimal
以下是分配给
| SqlDbType | 最大长度 | 精准率 | 比例尺/规模 | Locale | 比较选项 |
|---|---|---|---|---|---|
| Decimal | 9 | 18 | 0 | 0 | 没有 |
适用于
SqlMetaData(String, SqlDbType, Type)
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
使用指定的列名、类型和用户定义的类型(UDT)初始化类的新实例 SqlMetaData 。
public:
SqlMetaData(System::String ^ name, System::Data::SqlDbType dbType, Type ^ userDefinedType);
public SqlMetaData(string name, System.Data.SqlDbType dbType, Type userDefinedType);
new Microsoft.Data.SqlClient.Server.SqlMetaData : string * System.Data.SqlDbType * Type -> Microsoft.Data.SqlClient.Server.SqlMetaData
Public Sub New (name As String, dbType As SqlDbType, userDefinedType As Type)
参数
- name
- String
列的名称。
- dbType
- SqlDbType
参数或列的SQL Server类型。
例外
name 是 null。
不允许的项 SqlDbType 将传递给构造函数 dbType,或 userDefinedType 指向未 SqlUserDefinedTypeAttribute 声明的类型。
注解
仅允许将以下内容SqlDbType传递给构造函数:dbType. Udt
以下是分配给
| SqlDbType | 最大长度 | 精准率 | 比例尺/规模 | Locale | 比较选项 |
|---|---|---|---|---|---|
| Udt | <类型> 或 -1 的最大长度 | 0 | 0 | 0 | 没有 |
适用于
SqlMetaData(String, SqlDbType, Int64)
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
使用指定的列名、类型和最大长度初始化类的新实例 SqlMetaData 。
public:
SqlMetaData(System::String ^ name, System::Data::SqlDbType dbType, long maxLength);
public SqlMetaData(string name, System.Data.SqlDbType dbType, long maxLength);
new Microsoft.Data.SqlClient.Server.SqlMetaData : string * System.Data.SqlDbType * int64 -> Microsoft.Data.SqlClient.Server.SqlMetaData
Public Sub New (name As String, dbType As SqlDbType, maxLength As Long)
参数
- name
- String
列的名称。
- dbType
- SqlDbType
参数或列的SQL Server类型。
- maxLength
- Int64
指定类型的最大长度。
例外
name 是 null。
不允许的 SqlDbType 将传递给构造函数。dbType
示例
以下示例通过指定列名、列数据类型NVarChar和最大长度为 12 个字符来SqlMetaData创建新对象。
using Microsoft.Data.SqlClient.Server;
public static void CreateSqlMetaData1()
{
SqlMetaData columnInfo;
columnInfo = new SqlMetaData("Column1", SqlDbType.NVarChar, 12);
}
注解
仅允许将以下项传递给构造函数:dbType、、、CharNVarCharImageNTextNChar、 Text、。 VarBinaryVarCharBinary
只有一个maxLength或 -1 的规范Max允许 NTextdbTypeTextImage或 -1。
dbType
VarChar对于 、NVarChar或 VarBinary-1 的长度规范Max,分别将元数据声明为VARCHAR(MAX)、NVARCHAR(MAX)或 NVARBINARY(MAX)-1。
以下是分配给
| SqlDbType | 精准率 | 比例尺/规模 | Locale | 比较选项 |
|---|---|---|---|---|
| Binary | 0 | 0 | 0 | IgnoreCase、IgnoreKanaType、IgnoreWidth |
| Char | 0 | 0 | <thread> | IgnoreCase、IgnoreKanaType、IgnoreWidth |
| Image | 0 | 0 | 0 | 没有 |
| NChar | 0 | 0 | <thread> | IgnoreCase、IgnoreKanaType、IgnoreWidth |
| NText | 0 | 0 | <thread> | IgnoreCase、IgnoreKanaType、IgnoreWidth |
| NVarChar | 0 | 0 | <thread> | IgnoreCase、IgnoreKanaType、IgnoreWidth |
| Text | 0 | 0 | <thread> | IgnoreCase、IgnoreKanaType、IgnoreWidth |
| VarBinary | 0 | 0 | IgnoreCase、IgnoreKanaType、IgnoreWidth | |
| VarChar | 0 | 0 | <thread> | IgnoreCase、IgnoreKanaType、IgnoreWidth |
适用于
SqlMetaData(String, SqlDbType, Boolean, Boolean, SortOrder, Int32)
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
- Source:
- SqlMetaData.cs
使用指定的列名和默认服务器初始化类的新实例 SqlMetaData 。 这种形式的构造函数支持表值参数,即允许指定列在表值参数中是否唯一、该列的排序顺序以及排序列的序号。
public:
SqlMetaData(System::String ^ name, System::Data::SqlDbType dbType, bool useServerDefault, bool isUniqueKey, Microsoft::Data::SqlClient::SortOrder columnSortOrder, int sortOrdinal);
public SqlMetaData(string name, System.Data.SqlDbType dbType, bool useServerDefault, bool isUniqueKey, Microsoft.Data.SqlClient.SortOrder columnSortOrder, int sortOrdinal);
new Microsoft.Data.SqlClient.Server.SqlMetaData : string * System.Data.SqlDbType * bool * bool * Microsoft.Data.SqlClient.SortOrder * int -> Microsoft.Data.SqlClient.Server.SqlMetaData
Public Sub New (name As String, dbType As SqlDbType, useServerDefault As Boolean, isUniqueKey As Boolean, columnSortOrder As SortOrder, sortOrdinal As Integer)
参数
- name
- String
列的名称。
- dbType
- SqlDbType
参数或列的SQL Server类型。
- useServerDefault
- Boolean
指定此列是否应使用默认服务器值。
- isUniqueKey
- Boolean
指定表值参数中的列是否唯一。
- columnSortOrder
- SortOrder
指定列的排序顺序。
- sortOrdinal
- Int32
指定排序列的序号。
注解
有关详细信息,请参阅 Table-Valued 参数。