Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7190359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:29:50+00:00 2026-05-28T19:29:50+00:00

Everytime users did something like add, delete or edit data. I want to keep

  • 0

Everytime users did something like add, delete or edit data.
I want to keep the record of it. So system admin can see who did what later.

For example

  private AddUser(User id)
    {
        if(id != null)
        {
            MessageBox.Show("Item Updated");
            string sqlAddUser = "INSERT INTO 'DATABASE.USER' VALUES (Item.ID, Item.Name, Item.Address)";
            if(db.SqlNonQuery(sqlAddUser) //If successful
            {
                ///To DO : Add system log into database
                ///Ex. string sqlLog = DateTime.Now + User.ID + " added Item ID " + item.ID; 
            }
            else
            {
                MessageBox.Show("Error");            
            }    
        }
    }

Is there any better way or common practice to do it? Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:29:52+00:00Added an answer on May 28, 2026 at 7:29 pm

    In general for logging, I recommend Log4Net; it’s highly configurable and works great.

    However, if you don’t want to invest the time in implementing a third-party component and wanted to log to the database, you could do your data access via stored procedure, and have an INSERT into a logging table as part of the SP.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my WinForms app, data can be printed on many locations. Everytime the user
Everytime I upload a file to my ASP.NET site, all users are logged out
Everytime i retrieve data from a mysql stored procedure with a concat function an
On my website get articles with PHP query, something like $sql - (SELECT *
I have something like this in my Map public class Settings : ClassMap<Setting> {
I'm trying to do this update_activity_time everytime a user does something in the app.
vs2008 (and earlier versions) always creates empty folders in c:\users\<username>\my documents every time it
Every time a user posts something containing < or > in a page in
I would like to save the programs settings every time the user exits the
I have a photo gallery I would like that every time a user does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.