Q:

Storing date/time of Last Application Run

I'm working with a console application (C#) at the moment.  What it does is pulls files from a database and stores them in their relevant folders on the C drive on a local machine. 
At the moment, every time I run the console app, it pulls ALL the files from the database.  
What I would like to be able to do, is each time I run it, It only pulls the files that were submitted since I last ran the console application.  Currently, this is the linq statement that pulls the files from the database. 
var titleObjects = ctn. Titles. Where(t => ! t.Deleted && t.SubmissionState == 2 &&(t.Approved. HasValue && t.Approved. Value)).Select(t => t);

Ideally I'd like something like the following where the date and time of the last run of the application is stored somewhere:
var titleObjects = ctn. Titles. Where(t => ! t.Deleted && t.SubmissionState == 2 && t.CreatedDate >= LastAppRun && t.CreatedDate <= DateTime. Now  && (t.Approved. HasValue && t.Approved. Value)).Select(t => t);

I'm unsure on how to go about achieving this.  If anyone had any advice on it I'd be very greatful :)

A:

You can use app.settings for this.  It's a bit easier to just create a value and set its value as
Properties. Settings. Default.lastRunTime = DateTime. Now;
Properties. Settings. Default. Save();

It's a lot easier when you use the application with or without database 
You can also encrypt the settings.  google for encrypt. 

A:

Why not just create a table in the database and insert a record that contains the last run time.  Then update retrieve the value from the record on each run and update it when done. 
Or you could insert a record for each run, to keep track of when runs have occurred and select the record with the maximum date time on each run to work out when the last run was.