Click here to Skip to main content
15,885,703 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have created a Database
Create 1st Table as Registrations
Create 2nd Table as Customer Details
Admin has added 2 users in 1st Table let us say p,q
Once p user as get login he added 10 customers in 2nd Table
Once q user as get login he added 20 customers in 2nd Table

Once p user as logged in and access data he should get only 10 Records which are inserted by p user

Once q user as logged in and access data he should get only 20 Records which are inserted by q user

What I have tried:

I had created Tables of Registrations and Customer Details
Posted
Updated 29-Dec-21 23:14pm
v2

1 solution

Unless your table includes a "InsertedBy" column that identifies the user when the INSERT operation is made, it's complicated, and will depend on the database system and the way it is used by you.

If it's a multiuser DB system like SQL Server or MySQL and you use separate SQL user logins then you can use the Audit Log to access the info: How to Enable SQL Server Audit and Review the Audit Log[^]
But ... if your software doesn't do that, and / or it uses a single user DB, then you cannot find out who INSERTed or UPDATED a row.
 
Share this answer
 
v2

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