private static object GetSchemaValue(TdsDataColumn schema, object key) { if (schema.ContainsKey(key) && schema [key] != null) { return(schema [key]); } return(DBNull.Value); }
private static object GetSchemaValue(TdsDataColumn schema, string key) { object ret = schema [key]; if (ret == null) { return(DBNull.Value); } return(ret); }
private static object GetSchemaValue(TdsDataColumn schema, string key) { object val = schema [key]; if (val != null) { return(val); } else { return(DBNull.Value); } }
SqlInt64 GetSqlInt64(int i) { object value = GetSqlValue(i); // TDS 7.0 returns bigint as decimal(19,0) if (value is SqlDecimal) { TdsDataColumn schema = command.Tds.Columns[i]; if ((byte)schema["NumericPrecision"] == 19 && (byte)schema["NumericScale"] == 0) { value = (SqlInt64)(SqlDecimal)value; } } if (!(value is SqlInt64)) { throw new InvalidCastException("Type is " + value.GetType().ToString()); } return((SqlInt64)value); }
long GetInt64(int i) { object value = GetValue(i); // TDS 7.0 returns bigint as decimal(19,0) if (value is decimal) { TdsDataColumn schema = command.Tds.Columns[i]; if ((byte)schema["NumericPrecision"] == 19 && (byte)schema["NumericScale"] == 0) { value = (long)(decimal)value; } } if (!(value is long)) { if (value is DBNull) { throw new SqlNullValueException(); } throw new InvalidCastException("Type is " + value.GetType().ToString()); } return((long)value); }