public static object FixupParameter(object val)
{
if (val == null)
return null;
// Fox nulls come in as DbNull values
if (val is DBNull)
return null;
Type type = val.GetType();
// *** Fix up binary SafeArrays into byte[]
if (type.Name == "Byte[*]")
return ConvertObjectToByteArray(val);
//if (type == typeof(long) || type == typeof(Int64))
// return Convert.ToInt64(val);
//if (type == typeof(Single))
// return Convert.ToSingle(val);
// if we're dealing with ComValue parameter/value
// just use it's Value property
if (type == typeof(ComValue))
return ((ComValue)val).Value;
if (type == typeof(ComGuid))
return ((ComGuid)val).Guid;
if (type == typeof(ComArray))
return ((ComArray)val).Instance;
return val;
}