+ private object GetVariantValue ()
+ {
+ uint len = (uint)comm.GetTdsInt ();
+ if (len == 0)
+ return DBNull.Value;
+
+ // VARIANT_BASETYPE
+ TdsColumnType colType = (TdsColumnType)comm.GetByte ();
+ // VARIANT_PROPBYTES
+ byte propbytes = comm.GetByte ();
+ if (propbytes != 0)
+ // VARIANT_PROPERTIES
+ comm.Skip (propbytes);
+
+ len -= (uint)propbytes + 2;
+
+ switch (colType)
+ {
+ case TdsColumnType.Int1 :
+ case TdsColumnType.Int2 :
+ case TdsColumnType.Int4 :
+ case TdsColumnType.BigInt :
+ return GetIntValue (colType);
+ default:
+ // The old code was ignoring variants
+ // and returning null. Should we
+ // throw an exception?
+ comm.Skip (len);
+ break;
+ }
+
+ return DBNull.Value;
+ }
+