Q:

SQLite reader.read() always returning false when executed from Task Scheduler

I have a C# program that uses a SQLite database to read/write data.  This program requires UAC elevation and I require it to be running at all times.  When I run this program manually, which I have to 'Run as admin', my SQLite database functions normally, able to read/write data to the database file.  However, my issue is when I try to have this program execute automatically when the computer starts.
As I mentioned earlier, I require this program to execute at all times. So, I have put a couple things in place that re-executes the program in the event it crashes (which works great).  However, I also need this to begin executing when the computer restarts.  Normally this isn't a problem, but the program requires UAC and I will rarely be around to click Yes on the UAC dialog, so I read around and it seems the only way to do this was to set up a task in Task Scheduler.  So, I have set up a task to run this at startup.  Upon testing, the program does execute but not functioning correctly.  Upon further debugging, I've found that each time my code reaches a SQLiteDataReader.read() line, it always seems to return false even though I know there are records there, but this only happens when the program is executed thru Task Scheduler.  No errors seem to be coming from SQLite.  I suspect file permissions to be the issue, but do not know how to resolve.
A couple things to note of what I've tried already.
1) In the Task Scheduler, I've set this up to execute using the same user account as I've been using to run it manually, which is also a Domain Admin, Admin, and a local Admin account.
2) The task is set to "run with highest privileges"
3) I've changed the security permissions to Full Control for just about every object I can think of (Admins, Domain Admins, Users, , Everyone, etc) on both the root folder of the program AND the SQLite database file.
4) I've even tried moving the entire application outside of the Program Files folder in case there was some sort of restricted access involved there as well.
I'm at my wits end trying to figure this out.  Any ideas on what to try next?  Or other solutions to get this to execute correctly at startup without user interaction?

A:

I'm a bit late on reporting back on this issue.  Stupid on my part... The task scheduler simply needed to include the applications file folder path as the Startup path.  So it wasn't finding the database file as my path is using relative paths to reference.  I personally don't understand why this shouldn't always just default to the app's folder, but you live and you learn and bang your head on everything in between.

