I need to monitor an application when users log on and logoff in SQL SERVER, as sometimes the application logs unexpectedly, and I need to know because I audited the login and logout. When I use SQL Server Profiler, EventClass column appear "Audit Login" and "Audit Logout". Is there any way to get those SQL Server Profiler events in C #?

Thanks and regards.

有帮助吗?

解决方案

You'll need to create a server side trace that captures the events and columns of interest. You can create it it profiler and save it as a create script.

Your c# program can query the trace using the fn_trace_gettable() system function.

You'll want to pay careful attention to the setup of the rollover files in the trace definition. Filling up a disk drive isn't usually a good thing.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top