Dear All

May you kindly help me. I have a windows login form in I have a users table in MySQL. How can i use the users table in to login changes made to any table in MySql database. I only have 1 mysql databse user that i use in my connection string from all my windows forms

Recommended Answers

All 3 Replies

Since you have only one user, then by design you are not logging what each user is doing and audit logs may not be very useful.

MySQL now has audit logging ( ) so my advice is it's time to up your game (improve your design.)

You can take any number of approaches from changing your code to log each SQL request per user. That is, even in I can get the PC's name, username, IP address and write that to a simple log file or make a decision it's time to change my entire design. Your choice what to do next. Lots of options.

rproffitt......thank you for the reply. What I am really looking forward to accomplich is say
1. I have a application where users first login with username and passoword stored in MySQL table called users
2. After the user logs in then they will have access to several form and menus.
3. My connection string for the login form and all other forms is using only 1 MySQL database user and password.
4. So what i want is to log every change to MySQL tables when a user adds, removes or updates records in the database
5. I want these changes to be logged in an audit table in the database
6. The table columns will be (id, username(log in name), table_changed, old_value, new_value, date_changed)

I would greatly appreciate your help with examples if possible.

So item 4 is where you start working. There are many ways to do this, it's your app so you decide.
And item 5 is where you wrote how you want it done. That is you start coding to make that happen.
Same for item 6. Your DB design to meet your goals.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.