private static void setValue(DbFieldInfo field, object data, object value) { try { if (value == DBNull.Value) { field.SetValue(data, null); } else { Type type = DbConverter.GetType(field.FieldType); object convertedValue = Convert.ChangeType(value, type); field.SetValue(data, convertedValue); } } catch (Exception ex) { throw new NdbException("Can't set field value.\r\nField: " + field.Name + "\r\nValue: '" + value + "'\r\nError: " + ex.Message); } }
internal string GetSqlType(DbFieldInfo fieldInfo) { Type type = DbConverter.GetType(fieldInfo.FieldType); return(GetSqlType(type, fieldInfo.Size)); }