public static DateTime GetLastExecLogDate(int projectid) { try { InitConnection(); execlogTableAdapter adapter = new execlogTableAdapter(); if (adapter.Connection != null) adapter.Connection.Close(); adapter.Connection = sqlCon; object o = adapter.sp_GetLastExecLogDate(projectid); if (o == null) return new DateTime(1977, 1, 1); return Convert.ToDateTime(o); } catch (Exception exObj) { lastErrorString = exObj.Message; string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase); System.IO.File.AppendAllText(path.Replace("file:\\", "") + "\\dblog.txt", "[GetLastExecLogDate - " + DateTime.Now.ToString() + "]" + exObj.Message + "\r\n"); } return new DateTime(1977, 1, 1); }