public void WriteLog(string Msg) { string username = WindowsIdentity.GetCurrent().Name; SQL ErrSQL = new SQL(ConfigurationManager.AppSettings["UIFS.Log"].ToString()); ErrSQL.OpenDatabase(); ErrSQL.Query = string.Format(ErrSQL.SQLQuery.WriteLOG, 0, ErrSQL.ParseInput(Msg), username); ErrSQL.cmd = ErrSQL.Command(ErrSQL.Data); ErrSQL.cmd.ExecuteNonQuery(); ErrSQL.CloseDatabase(); ErrSQL = null; }
// Logging routines are specific to UIFS of course. As long as the user has provided the "UIFS.Log" appsetting in web.config, the errors // will be logged in the user's database of choice. public void WriteLog_Error(Exception ex, string ErrorMsg, string CodeLocation) { string username = WindowsIdentity.GetCurrent().Name; SQL ErrSQL = new SQL(ConfigurationManager.AppSettings["UIFS.Log"].ToString()); ErrSQL.OpenDatabase(); ErrSQL.Query = string.Format(ErrSQL.SQLQuery.WriteLOG_AppError, -1, ErrSQL.ParseInput(ErrorMsg), username, ErrSQL.ParseInput(ex.Message), ErrSQL.ParseInput(ex.Source), ErrSQL.ParseInput(ex.StackTrace), CodeLocation); ErrSQL.cmd = ErrSQL.Command(ErrSQL.Data); ErrSQL.cmd.ExecuteNonQuery(); ErrSQL.CloseDatabase(); ErrSQL = null; }