使用vb捕获用户登录和注销时间到sql server 2005数据库 [英] capturing user login and logout time using vb into sql server 2005 database

查看:65
本文介绍了使用vb捕获用户登录和注销时间到sql server 2005数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在将用户登录时间,logoutime,log_ID捕获到sql server 2005数据库的方式(代码等)上使用vb6的建议。关于表格结构的建议等,即登录和注销时的审计跟踪

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

推荐答案

每当有人登录你的应用程序时你就要登录数据库然后您可以使用数据库触发器捕获该信息(如果您已应用SP2)

查看 https://www.simple-talk.com/sql/t-sql-programming/logon-triggers/ [ ^ ]

和另一个样本在

http://blog.sqlauthority.com/2009/06/26/sql-server-interesting-observation-of-logon-trigger-on-all-servers-solution/ [ ^ ]



http://msdn.microsoft.com/en-gb/library/bb326598(v = SQL.90 ).aspx [ ^ ]



如果其他应用程序可以登录到同一个数据库,那可能会变得混乱,但您可以使用原理/表结构并写入直接来自你的应用程序。



一般观察 - 如果这是新代码(而不是对现有大型应用程序的增强)那么你应该考虑使用比VB6更多的最新技术(主要是缺乏支持) - 即使它是现有套件的一部分,您仍然可以使用.NET,请参阅 http://www.microsoft.com/en-gb/download/details.aspx?id=3264 [<小时ef =http://www.microsoft.com/en-gb/download/details.aspx?id=3264target =_ blanktitle =新窗口> ^ ]
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[^]


这篇关于使用vb捕获用户登录和注销时间到sql server 2005数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆