private SqlDataRecord SetDbRecord(SqlDataRecord record, object value, int index) { if (value.IsPrimitive()) { var cValue = Convert.ChangeType(value, record.GetFieldType(index)); record.SetValue(index, cValue); } else { record.SetValue(index, value.ToString()); } return record; }