Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need suggestions using vb6 on a way (code etc) of capturing users logintime, logoutime, log_ID into an sql server 2005 database. suggestions on structure of the table, etc. i.e audit trail on login & logout
Posted
Updated 17-Apr-13 5:10am
v2

1 solution

Well as you are going to log to a database everytime someone logs onto your application then you could just use database triggers to capture that information (if you've applied SP2)
Have a look at https://www.simple-talk.com/sql/t-sql-programming/logon-triggers/[^]
and another sample at
http://blog.sqlauthority.com/2009/06/26/sql-server-interesting-observation-of-logon-trigger-on-all-servers-solution/[^]
and
http://msdn.microsoft.com/en-gb/library/bb326598(v=sql.90).aspx[^]

That may get messy if other applications can log on to the same database, but you could use the principle / table structure and write to it directly from your application.

A general observation - if this is new code (and not an enhancement to a large existing suite of applications) then you should really consider using more up-to-date technology than VB6 (which is largely out of support) - even if it is part of an existing suite you can still use .NET see http://www.microsoft.com/en-gb/download/details.aspx?id=3264[^]
 
Share this answer
 

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