public static EMDataSet.POItemTblRow GetItemRowOrCreate(EMDataSet.POItemTblDataTable table, int poid, int index) { EMDataSet.POItemTblRow row = GetRowFromSeqNumber(table,index + 1); if (row != null) return (EMDataSet.POItemTblRow)row; int newSeqNumber = (int)(GetMaxSeqNumber(table) + 1); if (newSeqNumber != index + 1) { throw new Exception("Oops can't add more than one per call"); } row = table.NewPOItemTblRow(); row.SeqNumber = newSeqNumber; row.POItemNumber = DataInterface.GetNextKeyNumber("tblPOItem2"); row.POID = poid; DataInterface.ConformMetric(table,row); table.AddPOItemTblRow(row); return (EMDataSet.POItemTblRow)table.Rows[index]; }