internal static object GetComValueFromSqlVariant(object sqlVal)
{
object comVal = null;
if (ADP.IsNull(sqlVal))
return comVal;
if (sqlVal is SqlSingle)
comVal = ((SqlSingle)sqlVal).Value;
else if (sqlVal is SqlString)
comVal = ((SqlString)sqlVal).Value;
else if (sqlVal is SqlDouble)
comVal = ((SqlDouble)sqlVal).Value;
else if (sqlVal is SqlBinary)
comVal = ((SqlBinary)sqlVal).Value;
else if (sqlVal is SqlGuid)
comVal = ((SqlGuid)sqlVal).Value;
else if (sqlVal is SqlBoolean)
comVal = ((SqlBoolean)sqlVal).Value;
else if (sqlVal is SqlByte)
comVal = ((SqlByte)sqlVal).Value;
else if (sqlVal is SqlInt16)
comVal = ((SqlInt16)sqlVal).Value;
else if (sqlVal is SqlInt32)
comVal = ((SqlInt32)sqlVal).Value;
else if (sqlVal is SqlInt64)
comVal = ((SqlInt64)sqlVal).Value;
else if (sqlVal is SqlDecimal)
comVal = ((SqlDecimal)sqlVal).Value;
else if (sqlVal is SqlDateTime)
comVal = ((SqlDateTime)sqlVal).Value;
else if (sqlVal is SqlMoney)
comVal = ((SqlMoney)sqlVal).Value;
else if (sqlVal is SqlXml)
comVal = ((SqlXml)sqlVal).Value;
else
{
Debug.Assert(false, "unknown SqlType class stored in sqlVal");
}
return comVal;
}