private string BuildPKWhere(object Entity) { string RetVal = string.Empty; foreach (FieldDef fld in td.KeyFields.Values) { RetVal = string.Concat(RetVal, " AND ", dp.FormatSqlObject(fld.FieldName), "=", dp.FormatSqlValue(fld.GetValue(Entity), fld.DataType)); } return(RetVal.Substring(5)); }