1
我编写了一个CLR存储过程(列于下面) 仅添加了用于引发异常的代码行 在EventLog中记录了异常 我部署了程序集开创了数据库 存储的过程然而,当我执行存储过程的条目在Windows的事件日志调用.NET类实例的CLR存储过程
如果在事件日志在一个单独的Windows控制台应用程序,则记录异常
使用的代码登录任何帮助,将不胜感激
个感谢,
arunganu
.......
using System.Diagnostics;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
.......
[Microsoft.SqlServer.Server.SqlProcedure]
public static SqlInt32 Posting(SqlString tag)
{
try
{
...
throw new ArgumentException("arg exc");
...
return 0; // success
}
catch (Exception e)
{
try
{
EventLog PostingLog = new EventLog("Application");
PostingLog.Source = "Posting";
PostingLog.WriteEntry(e.Message, EventLogEntryType.Error);
PostingLog.Close();
return 1; // error
}
catch // in case when another exception is raised from the try block above
{
return 1; // error
}
}
}
在代码文本上使用代码格式。像这样它是不可读的 – terjetyl 2008-12-17 17:07:05