D
Drew
I have a permission tracking app that I am working on, and I have made the
insert page for it. I am having issues on how to prevent duplicates from
getting entered.
Currently the interface for the app has a mixture of select boxes, list
boxes and checkboxes. The form submits the page to processAIMR.asp and then
does the inserting. I am using a loop to insert a new record for each
checkbox checked or listbox entry selected.
My database table looks something like this,
UID - autoincrementing primary key
EmpID - the employee who the permission is given to
AuthEmpID - the employee who authorized the permission
AccessOption - the permission that was given (i.e. Internet Access, etc).
This is a foreign key to the AccessOptions table.
My question is concerning efficiency and how I should go about preventing or
removing the duplicates. There are a couple methods that I have thought
about using, but I am not sure which would be best.
1. Create a recordset on each run through the loop to check to see if the
AccessOption is already there for a certain EmpID. I would guess this would
be really hard on the server, but it would work.
2. Throw the recordset into an array, then check it (still kinda unsure how
to do this) on each run through the loop.
3. After the processAIMR.asp page has inserted, it redirects. Upon
redirection I could run a DELETE command that deletes all duplicates.
Which do you think would be the best route? Or maybe you have another idea?
Thanks,
Drew
insert page for it. I am having issues on how to prevent duplicates from
getting entered.
Currently the interface for the app has a mixture of select boxes, list
boxes and checkboxes. The form submits the page to processAIMR.asp and then
does the inserting. I am using a loop to insert a new record for each
checkbox checked or listbox entry selected.
My database table looks something like this,
UID - autoincrementing primary key
EmpID - the employee who the permission is given to
AuthEmpID - the employee who authorized the permission
AccessOption - the permission that was given (i.e. Internet Access, etc).
This is a foreign key to the AccessOptions table.
My question is concerning efficiency and how I should go about preventing or
removing the duplicates. There are a couple methods that I have thought
about using, but I am not sure which would be best.
1. Create a recordset on each run through the loop to check to see if the
AccessOption is already there for a certain EmpID. I would guess this would
be really hard on the server, but it would work.
2. Throw the recordset into an array, then check it (still kinda unsure how
to do this) on each run through the loop.
3. After the processAIMR.asp page has inserted, it redirects. Upon
redirection I could run a DELETE command that deletes all duplicates.
Which do you think would be the best route? Or maybe you have another idea?
Thanks,
Drew