简体   繁体   English

ADO.net中的SQL事件记录

[英]SQL event logging in ADO.net

We want to log sql events and its working but the problem is it always says sa as an user. 我们想记录sql事件及其工作情况,但问题是它总是以用户身份显示sa Whereas I would like this to be personalized. 而我希望将其个性化。

Is there anyway in ADO.Net where I can pass custom display name so that the logging of sql shows who the user is doing what in my DB? 无论如何,ADO.Net中是否可以传递自定义显示名称,以便sql的日志记录显示用户在数据库中执行的操作?

I know this question looks quite wierd but this is how my requirement is. 我知道这个问题看起来很奇怪,但这就是我的要求。 Any comments are highly appreciated. 任何意见,高度赞赏。

Don't log-in as SA! 不要以SA身份登录! That's a real big security problem just waiting to happen. 只是等待发生,这是一个真正的大安全问题。 Create other SQL users, and use them in your connection string. 创建其他SQL用户,并在您的连接字符串中使用它们。 That will let you control which user is shown on the profile, and also add you quite a bit of security. 这样一来,您可以控制哪个用户显示在配置文件中,并且还可以增加安全性。

Note: You could also log in based on your Windows credentials, which is even safer in some production environments, but you might not want to worry about it right now. 注意:您也可以基于Windows凭据登录,这在某些生产环境中甚至更安全,但是您现在可能不想担心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM