Possible Duplicate:
User Activity Profile and Statistics
I want to record users activity in my web application.I am talking about only following tables
Table 1:User<br>
Table 2:Sports<br>
Table 3:UserActivity
Option 1:
If user login/logout/Invalid login or sports inserted/updated/deleted. I log
activity from C# code in activity table against activity type.
Option 2:
I can use triggers in database to record user activity.
Which option is bettor and why eor you suggest any other option
There are many tables in database,I am just taking about two tables(user and sports)
There are pros and cons to both solutions
Implementing the activity logging in the application layer will generally be easier to implement and more flexible than database triggers, but will not be as robust, and there is no guarantee in the database that all activities are logged.
On the other hand, implementing the activity logging in the database layer is useful when you want to guarantee robustness, but is less flexible, and might not be portable across SQL implementations.
Your decision should be based on what your needs are.
Use application layer level logging if:
Use database layer level logging if: