本文整理汇总了C#中System.Data.SqlClient.TdsParserStateObject.TryReadDouble方法的典型用法代码示例。如果您正苦于以下问题:C# TdsParserStateObject.TryReadDouble方法的具体用法?C# TdsParserStateObject.TryReadDouble怎么用?C# TdsParserStateObject.TryReadDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SqlClient.TdsParserStateObject
的用法示例。
在下文中一共展示了TdsParserStateObject.TryReadDouble方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryReadSqlValueInternal
internal bool TryReadSqlValueInternal(SqlBuffer value, byte tdsType, int length, TdsParserStateObject stateObj)
{
switch (tdsType)
{
case TdsEnums.SQLBIT:
case TdsEnums.SQLBITN:
Debug.Assert(length == 1, "invalid length for SqlBoolean type!");
byte byteValue;
if (!stateObj.TryReadByte(out byteValue))
{
return false;
}
value.Boolean = (byteValue != 0);
break;
case TdsEnums.SQLINTN:
if (length == 1)
{
goto case TdsEnums.SQLINT1;
}
else if (length == 2)
{
goto case TdsEnums.SQLINT2;
}
else if (length == 4)
{
goto case TdsEnums.SQLINT4;
}
else
{
goto case TdsEnums.SQLINT8;
}
case TdsEnums.SQLINT1:
Debug.Assert(length == 1, "invalid length for SqlByte type!");
if (!stateObj.TryReadByte(out byteValue))
{
return false;
}
value.Byte = byteValue;
break;
case TdsEnums.SQLINT2:
Debug.Assert(length == 2, "invalid length for SqlInt16 type!");
short shortValue;
if (!stateObj.TryReadInt16(out shortValue))
{
return false;
}
value.Int16 = shortValue;
break;
case TdsEnums.SQLINT4:
Debug.Assert(length == 4, "invalid length for SqlInt32 type!");
int intValue;
if (!stateObj.TryReadInt32(out intValue))
{
return false;
}
value.Int32 = intValue;
break;
case TdsEnums.SQLINT8:
Debug.Assert(length == 8, "invalid length for SqlInt64 type!");
long longValue;
if (!stateObj.TryReadInt64(out longValue))
{
return false;
}
value.Int64 = longValue;
break;
case TdsEnums.SQLFLTN:
if (length == 4)
{
goto case TdsEnums.SQLFLT4;
}
else
{
goto case TdsEnums.SQLFLT8;
}
case TdsEnums.SQLFLT4:
Debug.Assert(length == 4, "invalid length for SqlSingle type!");
float singleValue;
if (!stateObj.TryReadSingle(out singleValue))
{
return false;
}
value.Single = singleValue;
break;
case TdsEnums.SQLFLT8:
Debug.Assert(length == 8, "invalid length for SqlDouble type!");
double doubleValue;
if (!stateObj.TryReadDouble(out doubleValue))
{
return false;
}
value.Double = doubleValue;
//.........这里部分代码省略.........