本文整理汇总了C#中Microsoft.SqlServer.Server.SqlDataRecord.GetInt32方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDataRecord.GetInt32方法的具体用法?C# SqlDataRecord.GetInt32怎么用?C# SqlDataRecord.GetInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.SqlServer.Server.SqlDataRecord
的用法示例。
在下文中一共展示了SqlDataRecord.GetInt32方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillCompatibleSettersFromRecord
internal static void FillCompatibleSettersFromRecord(SmiEventSink_Default sink, SmiTypedGetterSetter setters, SmiMetaData[] metaData, SqlDataRecord record, SmiDefaultFieldsProperty useDefaultValues)
{
for (int i = 0; i < metaData.Length; ++i)
{
if (null != useDefaultValues && useDefaultValues[i])
{
continue;
}
if (record.IsDBNull(i))
{
ValueUtilsSmi.SetDBNull_Unchecked(sink, setters, i);
}
else
{
switch (metaData[i].SqlDbType)
{
case SqlDbType.BigInt:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Int64));
SetInt64_Unchecked(sink, setters, i, record.GetInt64(i));
break;
case SqlDbType.Binary:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlBytes));
SetBytes_FromRecord(sink, setters, i, metaData[i], record, 0);
break;
case SqlDbType.Bit:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Boolean));
SetBoolean_Unchecked(sink, setters, i, record.GetBoolean(i));
break;
case SqlDbType.Char:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlChars));
SetChars_FromRecord(sink, setters, i, metaData[i], record, 0);
break;
case SqlDbType.DateTime:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.DateTime));
SetDateTime_Checked(sink, setters, i, metaData[i], record.GetDateTime(i));
break;
case SqlDbType.Decimal:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlDecimal));
SetSqlDecimal_Unchecked(sink, setters, i, record.GetSqlDecimal(i));
break;
case SqlDbType.Float:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Double));
SetDouble_Unchecked(sink, setters, i, record.GetDouble(i));
break;
case SqlDbType.Image:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlBytes));
SetBytes_FromRecord(sink, setters, i, metaData[i], record, 0);
break;
case SqlDbType.Int:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Int32));
SetInt32_Unchecked(sink, setters, i, record.GetInt32(i));
break;
case SqlDbType.Money:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlMoney));
SetSqlMoney_Unchecked(sink, setters, i, metaData[i], record.GetSqlMoney(i));
break;
case SqlDbType.NChar:
case SqlDbType.NText:
case SqlDbType.NVarChar:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlChars));
SetChars_FromRecord(sink, setters, i, metaData[i], record, 0);
break;
case SqlDbType.Real:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Single));
SetSingle_Unchecked(sink, setters, i, record.GetFloat(i));
break;
case SqlDbType.UniqueIdentifier:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Guid));
SetGuid_Unchecked(sink, setters, i, record.GetGuid(i));
break;
case SqlDbType.SmallDateTime:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.DateTime));
SetDateTime_Checked(sink, setters, i, metaData[i], record.GetDateTime(i));
break;
case SqlDbType.SmallInt:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Int16));
SetInt16_Unchecked(sink, setters, i, record.GetInt16(i));
break;
case SqlDbType.SmallMoney:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlMoney));
SetSqlMoney_Checked(sink, setters, i, metaData[i], record.GetSqlMoney(i));
break;
case SqlDbType.Text:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlChars));
SetChars_FromRecord(sink, setters, i, metaData[i], record, 0);
break;
case SqlDbType.Timestamp:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlBytes));
SetBytes_FromRecord(sink, setters, i, metaData[i], record, 0);
break;
case SqlDbType.TinyInt:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Byte));
SetByte_Unchecked(sink, setters, i, record.GetByte(i));
break;
case SqlDbType.VarBinary:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlBytes));
SetBytes_FromRecord(sink, setters, i, metaData[i], record, 0);
break;
case SqlDbType.VarChar:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.String));
//.........这里部分代码省略.........
示例2: FillCompatibleITypedSettersFromRecord
internal static void FillCompatibleITypedSettersFromRecord(SmiEventSink_Default sink, ITypedSettersV3 setters, SmiMetaData[] metaData, SqlDataRecord record, SmiDefaultFieldsProperty useDefaultValues)
{
for (int i = 0; i < metaData.Length; i++)
{
if ((useDefaultValues != null) && useDefaultValues[i])
{
continue;
}
if (record.IsDBNull(i))
{
SetDBNull_Unchecked(sink, setters, i);
continue;
}
switch (metaData[i].SqlDbType)
{
case SqlDbType.BigInt:
{
SetInt64_Unchecked(sink, setters, i, record.GetInt64(i));
continue;
}
case SqlDbType.Binary:
{
SetBytes_FromRecord(sink, setters, i, metaData[i], record, 0);
continue;
}
case SqlDbType.Bit:
{
SetBoolean_Unchecked(sink, setters, i, record.GetBoolean(i));
continue;
}
case SqlDbType.Char:
{
SetChars_FromRecord(sink, setters, i, metaData[i], record, 0);
continue;
}
case SqlDbType.DateTime:
{
SetDateTime_Checked(sink, setters, i, metaData[i], record.GetDateTime(i));
continue;
}
case SqlDbType.Decimal:
{
SetSqlDecimal_Unchecked(sink, setters, i, record.GetSqlDecimal(i));
continue;
}
case SqlDbType.Float:
{
SetDouble_Unchecked(sink, setters, i, record.GetDouble(i));
continue;
}
case SqlDbType.Image:
{
SetBytes_FromRecord(sink, setters, i, metaData[i], record, 0);
continue;
}
case SqlDbType.Int:
{
SetInt32_Unchecked(sink, setters, i, record.GetInt32(i));
continue;
}
case SqlDbType.Money:
{
SetSqlMoney_Unchecked(sink, setters, i, metaData[i], record.GetSqlMoney(i));
continue;
}
case SqlDbType.NChar:
case SqlDbType.NText:
case SqlDbType.NVarChar:
{
SetChars_FromRecord(sink, setters, i, metaData[i], record, 0);
continue;
}
case SqlDbType.Real:
{
SetSingle_Unchecked(sink, setters, i, record.GetFloat(i));
continue;
}
case SqlDbType.UniqueIdentifier:
{
SetGuid_Unchecked(sink, setters, i, record.GetGuid(i));
continue;
}
case SqlDbType.SmallDateTime:
{
SetDateTime_Checked(sink, setters, i, metaData[i], record.GetDateTime(i));
continue;
}
case SqlDbType.SmallInt:
{
SetInt16_Unchecked(sink, setters, i, record.GetInt16(i));
continue;
}
case SqlDbType.SmallMoney:
{
SetSqlMoney_Checked(sink, setters, i, metaData[i], record.GetSqlMoney(i));
continue;
}
case SqlDbType.Text:
{
SetChars_FromRecord(sink, setters, i, metaData[i], record, 0);
//.........这里部分代码省略.........
示例3: FillCompatibleITypedSettersFromRecord
internal static void FillCompatibleITypedSettersFromRecord(SmiEventSink_Default sink, ITypedSettersV3 setters, SmiMetaData[] metaData, SqlDataRecord record, SmiDefaultFieldsProperty useDefaultValues) {
for (int i = 0; i < metaData.Length; ++i) {
if (null != useDefaultValues && useDefaultValues[i]) {
continue;
}
if (record.IsDBNull(i)) {
ValueUtilsSmi.SetDBNull_Unchecked(sink, setters, i);
} else {
switch (metaData[i].SqlDbType) {
case SqlDbType.BigInt:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.Int64 ) );
SetInt64_Unchecked( sink, setters, i, record.GetInt64(i) );
break;
case SqlDbType.Binary:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.SqlBytes ) );
SetBytes_FromRecord( sink, setters, i, metaData[i], record, 0 );
break;
case SqlDbType.Bit:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.Boolean ) );
SetBoolean_Unchecked( sink, setters, i, record.GetBoolean(i) );
break;
case SqlDbType.Char:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.SqlChars ) );
SetChars_FromRecord( sink, setters, i, metaData[i], record, 0 );
break;
case SqlDbType.DateTime:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.DateTime ) );
SetDateTime_Checked( sink, setters, i, metaData[i], record.GetDateTime(i) );
break;
case SqlDbType.Decimal:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.SqlDecimal ) );
SetSqlDecimal_Unchecked( sink, setters, i, record.GetSqlDecimal(i) );
break;
case SqlDbType.Float:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.Double ) );
SetDouble_Unchecked( sink, setters, i, record.GetDouble(i) );
break;
case SqlDbType.Image:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.SqlBytes ) );
SetBytes_FromRecord( sink, setters, i, metaData[i], record, 0 );
break;
case SqlDbType.Int:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.Int32 ) );
SetInt32_Unchecked( sink, setters, i, record.GetInt32(i) );
break;
case SqlDbType.Money:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.SqlMoney ) );
SetSqlMoney_Unchecked( sink, setters, i, metaData[i], record.GetSqlMoney(i) );
break;
case SqlDbType.NChar:
case SqlDbType.NText:
case SqlDbType.NVarChar:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.SqlChars ) );
SetChars_FromRecord( sink, setters, i, metaData[i], record, 0 );
break;
case SqlDbType.Real:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.Single ) );
SetSingle_Unchecked( sink, setters, i, record.GetFloat(i) );
break;
case SqlDbType.UniqueIdentifier:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.Guid ) );
SetGuid_Unchecked( sink, setters, i, record.GetGuid(i) );
break;
case SqlDbType.SmallDateTime:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.DateTime ) );
SetDateTime_Checked( sink, setters, i, metaData[i], record.GetDateTime(i) );
break;
case SqlDbType.SmallInt:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.Int16 ) );
SetInt16_Unchecked( sink, setters, i, record.GetInt16(i) );
break;
case SqlDbType.SmallMoney:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.SqlMoney ) );
SetSqlMoney_Checked( sink, setters, i, metaData[i], record.GetSqlMoney(i) );
break;
case SqlDbType.Text:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.SqlChars ) );
SetChars_FromRecord( sink, setters, i, metaData[i], record, 0 );
break;
case SqlDbType.Timestamp:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.SqlBytes ) );
SetBytes_FromRecord( sink, setters, i, metaData[i], record, 0 );
break;
case SqlDbType.TinyInt:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.Byte ) );
SetByte_Unchecked( sink, setters, i, record.GetByte(i) );
break;
case SqlDbType.VarBinary:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.SqlBytes ) );
SetBytes_FromRecord( sink, setters, i, metaData[i], record, 0 );
break;
case SqlDbType.VarChar:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.String ) );
SetChars_FromRecord( sink, setters, i, metaData[i], record, 0 );
break;
case SqlDbType.Xml:
Debug.Assert( CanAccessSetterDirectly( metaData[i], ExtendedClrTypeCode.SqlXml ) );
SetSqlXml_Unchecked( sink, setters, i, record.GetSqlXml(i) ); // perf improvement?
break;
case SqlDbType.Variant:
//.........这里部分代码省略.........
示例4: FillCompatibleSettersFromRecord
internal static void FillCompatibleSettersFromRecord(SmiEventSink_Default sink, SmiTypedGetterSetter setters, SmiMetaData[] metaData, SqlDataRecord record, SmiDefaultFieldsProperty useDefaultValues)
{
for (int i = 0; i < metaData.Length; i++)
{
DateTimeOffset dateTimeOffset;
TimeSpan timeSpan;
if ((useDefaultValues != null) && useDefaultValues[i])
{
continue;
}
if (record.IsDBNull(i))
{
SetDBNull_Unchecked(sink, setters, i);
continue;
}
switch (metaData[i].SqlDbType)
{
case SqlDbType.BigInt:
{
SetInt64_Unchecked(sink, setters, i, record.GetInt64(i));
continue;
}
case SqlDbType.Binary:
{
SetBytes_FromRecord(sink, setters, i, metaData[i], record, 0);
continue;
}
case SqlDbType.Bit:
{
SetBoolean_Unchecked(sink, setters, i, record.GetBoolean(i));
continue;
}
case SqlDbType.Char:
{
SetChars_FromRecord(sink, setters, i, metaData[i], record, 0);
continue;
}
case SqlDbType.DateTime:
{
SetDateTime_Checked(sink, setters, i, metaData[i], record.GetDateTime(i));
continue;
}
case SqlDbType.Decimal:
{
SetSqlDecimal_Unchecked(sink, setters, i, record.GetSqlDecimal(i));
continue;
}
case SqlDbType.Float:
{
SetDouble_Unchecked(sink, setters, i, record.GetDouble(i));
continue;
}
case SqlDbType.Image:
{
SetBytes_FromRecord(sink, setters, i, metaData[i], record, 0);
continue;
}
case SqlDbType.Int:
{
SetInt32_Unchecked(sink, setters, i, record.GetInt32(i));
continue;
}
case SqlDbType.Money:
{
SetSqlMoney_Unchecked(sink, setters, i, metaData[i], record.GetSqlMoney(i));
continue;
}
case SqlDbType.NChar:
case SqlDbType.NText:
case SqlDbType.NVarChar:
{
SetChars_FromRecord(sink, setters, i, metaData[i], record, 0);
continue;
}
case SqlDbType.Real:
{
SetSingle_Unchecked(sink, setters, i, record.GetFloat(i));
continue;
}
case SqlDbType.UniqueIdentifier:
{
SetGuid_Unchecked(sink, setters, i, record.GetGuid(i));
continue;
}
case SqlDbType.SmallDateTime:
{
SetDateTime_Checked(sink, setters, i, metaData[i], record.GetDateTime(i));
continue;
}
case SqlDbType.SmallInt:
{
SetInt16_Unchecked(sink, setters, i, record.GetInt16(i));
continue;
}
case SqlDbType.SmallMoney:
{
SetSqlMoney_Checked(sink, setters, i, metaData[i], record.GetSqlMoney(i));
continue;
}
case SqlDbType.Text:
//.........这里部分代码省略.........