Issue with Data Access Application Block

Topics: Data Access Application Block
Nov 25, 2012 at 6:05 AM

Hello,

I have successfully implemented DAAB which does the Inserts and Updates on the data. But, I am facing following issue

The table onto which the DAAB is working, has got a trigger defined on it. The trigger fires when an Insert/Update happens on that table. The table has a column called "LAST_UPDATE" which stores the datetime entry. For a particular row, when the Insert happens, datetime entry is stored there. When the Update happens, that particular datetime is stored. This all happens by the way of trigger.

Problem:

Even if I suppy the same values for a particular value, the trigger is getting fired and LAST_UPDATE is getting updated. I want to avoid this anyhow. Pls suggest a.s.ap.

Thanks,

 

Nov 26, 2012 at 3:48 AM

The trigger will get fired when an update (or an insert) operation is performed (depending on the operation).  That is how triggers work.  

If I understand correctly you want to not update the LAST_UPDATE DateTime if an update is performed but the data did not change.  I'm not sure about your exact design but you could check the before and after (AKA Deleted and Inserted) values and only update the LAST_UPDATE if the values are different.  Another option might be to use an instead of trigger.

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com