private void NewRowManual(ref SGroupRow ARow) { // Deal with primary key. GroupId is unique. UnitKey is always 0 string newName = Catalog.GetString("NEWCODE"); Int32 countNewDetail = 0; if (FMainDS.SGroup.Rows.Find(new object[] { newName, 0 }) != null) { while (FMainDS.SGroup.Rows.Find(new object[] { newName + countNewDetail.ToString(), 0 }) != null) { countNewDetail++; } newName += countNewDetail.ToString(); } ARow.GroupId = newName; }