public void UpdateRowid(long?rowid) { using (var dc = new shortenURLEntities()) { var res = dc.tmp_rownum_update.SingleOrDefault(x => x.PK_RowUpdate_ID == 1); if (res != null) { res.row_update = rowid; dc.SaveChanges(); } // dc.tmp_rownum_update.Where(x => x.PK_RowUpdate_ID == 1).Update(y => new tmp_rownum_update { row_update = rowid }); } }
public static void LogErrorData(string stackTraceInfo, string message) { try { shortenURLEntities dc = new shortenURLEntities(); ErrorLog objErrorLog = new ErrorLog(); objErrorLog.StackTrace = stackTraceInfo; objErrorLog.ErrorMessage = message; objErrorLog.DateCreated = System.DateTime.Now; dc.ErrorLogs.Add(objErrorLog); dc.SaveChanges(); string err = ""; err = "Error Occured on:" + DateTime.Now.ToString() + "<br>"; err += "Message: " + message; err += "Stack Trace:<br>" + stackTraceInfo; //EmailUtil.SendMail("*****@*****.**", ConfigurationManager.AppSettings["Error Mail"].ToString(), "", "", "Error ShortenURL", " <br>Message : " + err); } catch (Exception ex) { } }