Reputation: 169
I have a program created using c# which will resides at the c:\program files folder. I will get error if I am going to run this part
SQLiteConnection.CreateFile("db/MyDatabase.sqlite");
I already read about User Account Control thing here http://blogs.windows.com/windows/archive/b/developers/archive/2009/08/04/user-account-control-data-redirection.aspx but i really don't have any idea on how to do it..
My program will be in C:\program files\my program\db\MyDatabase.sqlite
Upvotes: 0
Views: 2215
Reputation: 23093
Try using the AppData folder - you should not save such stuff in ProgramFiles anyway:
var dir = Path.Combine(Environment
.GetFolderPath(Environment.SpecialFolder.ApplicationData), "MyProgram");
if(!Directory.Exists(dir))
Directory.CreateDirectory(dir);
SQLiteConnection.CreateFile(Path.Combine(dir, "MyDatabase.sqlite"));
Upvotes: 1