public static void InsertError(Exception ex) { using (CurrenciesDataContext dc = new CurrenciesDataContext()) { tblError error = new tblError() { Message = ex.Message, StackTrace = ex.StackTrace }; dc.tblErrors.InsertOnSubmit(error); dc.SubmitChanges(); } }
public void TapErrortoDB(ivimessageboardEntities DBentities, string errortext, string classname, string methodname) { try { tblError error = new tblError(); error.ErrorText = errortext; error.ErrorClassName = classname; error.ErrorMethodName = methodname; DBentities.tblErrors.Add(error); DBentities.SaveChanges(); } catch (Exception ex) { } }
public void AddErrorLog(ref Exception strException, string PageName, string UserType, int UserID, int AdminID, string MACAddress = null) { http: //localhost:11033/Default.aspx.cs var DC = new DataClassesDataContext(); //Insert record in ErrorLog tblError objError = new tblError(); objError.PageName = PageName; objError.Description = strException.Message.ToString(); objError.CreatedOn = Convert.ToDateTime(System.DateTime.Now); objError.UserType = UserType; if (UserID != 0) { objError.UserID = UserID; } else { objError.UserID = null; } if (AdminID != 0) { objError.AdminID = AdminID; } else { objError.AdminID = null; } if (MACAddress != null) { objError.MacAddress = MACAddress; } else { objError.MacAddress = null; } DC.tblErrors.InsertOnSubmit(objError); DC.SubmitChanges(); }