Hi Michael
Thanks for your reply. Your thought trail is one that I followed exactly. I suppose I should give you more information to explain exactly where I'm getting stuck.
Seeing as the information is being deleted, I added an update statement to my "delete" stored procedure in the database. Herewith the example code:
ALTER procedure xxxx
@ModuleId Int,
@DetailItemId int,
@UserId int
as
--This is a work around for the auditing purposes
--We need to know who the user is that deleted this record. But because the user is not SQL managed and rather
--managed in the Users table and by the DotNetNuke application, we have to provide the trigger with the user that
--actually deleted the record and therefore it is passed into this procedure as a parameter.
--We have to be careful now, because we need to update the ByUser, field for the trigger to use, but not log an "Update" in the audit table
--If you'll look carefully at the trigger,
--you'll see that we don't log an audit if just the "ByUser" column is updated
BEGIN
UPDATE Table
SET CreatedByUser = @UserId
WHERE ItemId = @DetailItemId
END
BEGIN
--Now that the user is updated to the person who is deleting the record, we will pick it up in the trigger and log it as such
DELETE
FROM Table
WHERE ItemId = @DetailItemId
END
Where I get stuck, is that in order for me to update the UserID, it has to be passed into the stored procedure from the front end. I am using the normal "delete" method of the object data source, which does not call any "update" related methods or procedures from the front end or in the other layers because that is how it is set up.
So in essence, what I actually need, is to know who the person is on the front end that hit the "delete" button. I only care about who that person is on the front end. As soon as the delete proc is hit in the database, I run the update statement, then immediately after that the delete, and the trigger code is clever enough to log the user that deleted the information into the audit table.
Based on your suggestion, is there a way that I can call an "update" method from the front end when the object data source is asked to execute the procedure in the delete method? The only way I can imagine doing this is with code on the front end, but I'm not sure where to start...
Am I making sense?
:-)