This program is quite elegant in it's use of pointers. Except for the memory leak, it's a gem, and clearly, not your original code. However, after the original wheel, there has never been an original outside rim shape for any wheel, either. They're all round.
NHBad, take a look at the transaction code, and write out in just plain English, what would be the programs logic for each code. Something like:
Code is 0:
a) add a new blank record to the database with an ID number and name.
Code is 1:
Then we'll take that and form it up into code, using that logic. So if your logic is haywire, the resulting transaction function code, will also be haywire.
Time is of the essence here. If you take a week or ten days to get back with your input, you're taking a big chance nobody will still be interested in this program. In about a week, I will be starting another programming project, and be quite unavailable. If you want to finish this project with assistance from this forum, I'd put it in high gear. As you've seen, a simple bump is not much help.