Click here to Skip to main content
15,508,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
My lecturer said we should think about a report log that you use on a windows form.
basically what i am asking is if a user uses my winform that is connected to a database and they add, modify or delete from a database i could just have a button to show the "activity" if any in a text box or a .txt file. like a report log

i don't have code yet, if u can help me to get in right direction or an article or code will be helpful
Posted
Updated 26-Aug-12 8:27am
v2
Comments
[no name] 26-Aug-12 13:34pm    
You should try something and if you have any problem we are here.
I.explore.code 26-Aug-12 14:07pm    
Try exploring the System.IO namespace its a goldmine of File I/O operations in .NET. Basically, what you want is after every operation i.e. Add, Update, Delete, a line that writes to a file the event, date and time.

1 solution

In my opinion, you need to create an 'user-activity' database. It's simple to do, because it should at least have only one table, like this:
ActivityID - INT (IDENTITY)<br />
UserID - INT  -> user name, id or any other unique value<br />
DatabaseID -> database name, id or any other unique value<br />
TableId -> table name, id or any other unique value<br />
UserActivity - VARCHAR(255)  -> description of user activity<br />
ActivityTime - DateTime<br />

The number of tables or fields depends on your criteria.

Before you save data, save user 'activity'.
 
Share this answer
 
Comments
Swinkaran 26-Aug-12 20:42pm    
This is fine. May be you create a table in the database(with the fields mentioned by losmac.) and feed each user 'activity' to the database manually. For example, if a new record is added to the table then, Add a new row to the 'activity' table.

losmac, 'datetime' of the event should be there
Maciej Los 27-Aug-12 3:26am    
I agree with you, it could be a table in the same database, but my practice "tell me": better way to achieve this is to create a separatly database, especially when you are an admin of many databases. ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900