Beispiel #1
0
        //
        // Delete_Records()
        //
        // This function deletes all the records in the table
        //

        static void Delete_Records(CTRecord record)
        {
            bool found;

            Console.WriteLine("\tDelete records...");

            try
            {
                // write lock required for transaction updates
                record.Lock(LOCK_MODE.WRITE_LOCK);

                // start a transaction
                record.Begin();

                // read first record
                found = record.First();

                while (found) // while records are found
                {
                    // delete record
                    record.Delete();
                    // read next record
                    found = record.Next();
                }

                // commit transaction
                record.Commit();

                // free locks
                record.Unlock();
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }
        }