日期:2014-05-17 浏览次数:20512 次
use master
go
--在数据库启动时,会自动调用这个存储过程,这个clr存储过程已注册
exec sp_procoption '存储过程名','startup','on'
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.Diagnostics;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Windows日志有:"Application"应用程序, "Security"安全, "System"系统
string[] logs = new string[] { "Application", "System" };
StringBuilder result = new StringBuilder();
foreach (string log in logs)
{
EventLog myLog = new EventLog();
myLog.Log = log;
//myLog.MachineName = "rondi-agt0qf9op";
foreach (EventLogEntry entry in myLog.Entries)
{
//EventLogEntryType枚举包括:
//Error 错误事件。
//FailureAudit 失败审核事件。
//Information 信息事件。
//SuccessAudit 成功审核事件。
//Warning 警告事件。
&n