public static int AddExecLog(int projectid, DateTime dt, bool iserror, string errormsg, string methodname) { try { InitConnection(); execlogTableAdapter adapter = new execlogTableAdapter(); if (adapter.Connection != null) adapter.Connection.Close(); adapter.Connection = sqlCon; return Convert.ToInt32(adapter.sp_AddExecLog(projectid, methodname, dt, iserror, errormsg)); } catch (Exception exObj) { lastErrorString = exObj.Message; string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase); System.IO.File.AppendAllText(path.Replace("file:\\", "") + "\\dblog.txt", "[AddExecLog - " + DateTime.Now.ToString() + "]" + exObj.Message + "\r\n"); } return 0; }