473,809 Members | 2,908 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to identify a user of concurrent users in centralized sql server database

16 New Member
Dear Friends,
We are developing an inventory maintenance project in C#.net 2005 with MSDE as back end.Data can be accessed by multiuser at the same time, because they are from a single centralized database.
Now, we are planning to implement audit trail to track which record is manipulated by which user.
Jan 20 '08 #1
8 2664
ck9663
2,878 Recognized Expert Specialist
Dear Friends,
We are developing an inventory maintenance project in C#.net 2005 with MSDE as back end.Data can be accessed by multiuser at the same time, because they are from a single centralized database.
Now, we are planning to implement audit trail to track which record is manipulated by which user.
depending on some factors. your authentication method, your system design, your entire system architecture...

you can use the system_user, user_name() system variable and function, you can either create a stored proc that update your audit table...or create a trigger that update your audit table every time there's an update on your transaction table...or if you create a before and after update record on your transaction table, you can just add an UpdatedBy field and update it everytime..

-- CK
Jan 20 '08 #2
PreethiParkavi
16 New Member
Thank You CK.I thought ,As you say ,It is good to have "UpdatedBy" field in every tables which are going to be audited.Before implementing this, I am having doubt,
Is it possible to pass argument to a trigger which will resolve this problem with less effort from client program?.please advice me.
Jan 22 '08 #3
ck9663
2,878 Recognized Expert Specialist
Thank You CK.I thought ,As you say ,It is good to have "UpdatedBy" field in every tables which are going to be audited.Before implementing this, I am having doubt,
Is it possible to pass argument to a trigger which will resolve this problem with less effort from client program?.please advice me.
I don't think you can. But there could be other ways of doing it. What argument are you trying to pass and what is it for?

-- ck
Jan 22 '08 #4
PreethiParkavi
16 New Member
Thank you CK for your helps.
I am thinking of passing log in user name (which is in "Employee" table) as argument.with this, we can insert the audit log which record is manipulated by which user.How to we accomplish this through triggers/any other T-SQL code ?

Thanks,
Preethi
Jan 23 '08 #5
ck9663
2,878 Recognized Expert Specialist
Thank you CK for your helps.
I am thinking of passing log in user name (which is in "Employee" table) as argument.with this, we can insert the audit log which record is manipulated by which user.How to we accomplish this through triggers/any other T-SQL code ?

Thanks,
Preethi
so the login profile (username, password) is on the Employee table? i would assume you're using some sort of front-end application. you can keep the employeeid on the application side. during insert, you have call a stored procedure that grabs other info on your employee table that you want inserted on your transaction table, then you do the insert..

or........

you can actually create an updatable view. and update all the table as necessary.

-- ck
Jan 23 '08 #6
PreethiParkavi
16 New Member
Hi CK,
You are right in that I am using Front-End application which holds logged user details.I Could not understand the "Updateable View" concept.Could you explain it for me to implement audit-log.

Thanks with Anticipation,
Preethi
Jan 23 '08 #7
ck9663
2,878 Recognized Expert Specialist
Hi CK,
You are right in that I am using Front-End application which holds logged user details.I Could not understand the "Updateable View" concept.Could you explain it for me to implement audit-log.

Thanks with Anticipation,
Preethi

options 1:
1. create an RecordStat, UpdatedBy, UpdatedOn columns on your table.
2. get all the value of the fields of the table you are updating.
3. instead of issuing an UPDATE statement on the updated field, just update RECORDSTAT = 'I' (or 0 or whatever value you like to signify that the status of the record is inactive). this can also be done if the user delete the record from the GUI
4. on your update statement, build it in such a way that it will be a combination of values from your variable and from your GUI. the value from your variable are those you gather from #2 (above). the value from your GUI are those that your user updated.however for Recordstat = 'A', UpdatedBy = ValueFromYourGU IThatHoldsUserL oggedInfo, UpdatedOn = systemdate(). you will now have an almost duplicate record. with the exception of the fields that were updated and the 3 new fields.
5. In all your query, you have to be conscious that only active records has to be chosen. this means you have to add WHERE RECORDSTAT = 'A' on all your query.

challenge: a user can go to sql analyzer and mess up your table and no audit will be done


option 2:
1. create an RecordStat, UpdatedBy, UpdatedOn columns on your table.
2. create an update trigger on your table
2.a. when update trigger fires, insert the entire deleted table on your table with the exception of RecordStat values of these fields should be RecordStat = 'I'.
3. you should have an almost identical record with the exception of the three fields.
4. In all your query, you have to be conscious that only active records has to be chosen. this means you have to add WHERE RECORDSTAT = 'A' on all your query.

challenge: lot of programming work; disk space (but storage are cheap)


option 3:
1. create an update and delete trigger on your table.
2. when update or delete trigger fires, insert the deleted table into a "dump" table where you dump all updates and deletes. before inserting, make sure to capture the UpdatedBy and UpdatedOn values.
3. this way, you don't change any other queries, you keep your table as is, and you have the audit somewhere else. you can use the audit table for analysis

challenge: lot of programming work; disk space (but storage are cheap); your table is not really complete and has to be split into two


it would all depend on how big your table is. this could all be fine if you have small size. for bigger (read: million-s), try option 3. try all and check for performance.

views
triggers

hope that make sense :)

-- ck
Jan 23 '08 #8
PreethiParkavi
16 New Member
Thank You to you CK for spending your valuable time for me. I am trying to implement the third option with triggers and updated field and ask your help if I needed.

With Thanks ,
Preethi.
Jan 24 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3071
by: Brad H McCollum | last post by:
I'm writing an application using VB 6.0 as the front-end GUI, and the MSDE version of SQL Server as the back-end (it's a program for a really small # of users --- less then 3-4). I'm trying to determine, through the Visual Basic interface, the permissions of each user that's using the application on his/her machine. For example, let's say I'm user "Michael" that's sitting down at my machine using the app. I've written. The security...
3
9198
by: canigou9 (remove your socks to reply) | last post by:
(cross posted - comp.databases.ms-access, microsoft.public.access) Hello folks - this is my first post here, after a short lurk. I have written an application in Access2002 for a friend's business which allows him to take orders, arrange deliveries and trace deliveries back in the event of subsequent complaints. It uses a handful of tables in a relational schema, with a few ancillary lookup tables, some forms, reports and VBA modules.
8
4032
by: pnp | last post by:
Hi all, I've developed a win C# app that is actually database driven using SQL server 2000. The idea is that only one application will be installed on a server in a network and the program will be able to run at each client machine by just double-clicking the application executable through a network share. The program supports user logins. What I want to do is find a secure way to control the number of concurrent *users* using the...
2
2652
by: flat_ross | last post by:
Hi, I am in a shop where developers are required to work off of a network share. This is so that code is backed up nightly. So I am testing running an ASP.NET Web application with a Class assembly all on a shared drive. I have the solution working perfectly. However, I have run into a hiccup. In order to map IIS Virtual Dir to a network drive, you need
4
3541
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The objective in utilizing this new deployment method is to reduce the maintenance overhead as well as making it easier for my users to setup and run the application initially. I have VS 2002, Windows XP, Access XP(2000 format). He is my problem....
2
1351
by: Cincin | last post by:
We were building this forum application and we stumble on how to identify unread post. One thing would be to keep in the database what an user have seen but it doesn't seem doable because of the possible large number of users/posts and also anonymous users. Do you have an idea on how this can be done, what options do I have to do this? Thanks
4
4157
by: Peppie | last post by:
I have a (self proclaimed ) very nice and well designed database that organizes my clients, contacts, projects and documents sent to my clients (including a report generator in MS Word). At this moment, the database is used by appr. 100 users in two countries. So far, no problems, but I have the feeling that I should take this thing a bit further. I would like to create a user interface (a copy of the current user interface) that runs...
6
4127
by: goraya | last post by:
This is design level discussion about web applications. How I design application that support 1 million concurrent requests??
2
19349
by: mktselvan | last post by:
Hi, Existing running oracle application 11i (11.5.8) Database version is 8.1.7.4 There is any command / way to know the number of concurrent users for this application. select SESSIONS_MAX, SESSIONS_WARNING,
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10633
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10114
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.