filenotfoundexception error- c#- with database
Posted on 2011-10-11
i have a C# windows form application w/microsoft access database.in the visual studio 2008 enviroment- it runs with no problems. I can also go to debug folder and copy the exe file and database- and it works ( although- this is not correct way to deploy a c# app).
database is on local network- txt file in debug folder - the program.cs file loads form1 and checks for the txt file. (i read that txt file has to be in same folder where application .exe resides).
Then it checks for database and loads application.
Code in the program.sc file:
System.IO.StreamReader file = new System.IO.StreamReader(Application.StartupPath + "\\dbpath.txt");
Code in form1:
OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Program.dbPath + "\\data13.mdb");
am getting a filenotfoundException when try to deploy it.
In the app.publish folder- there is setup.exe, publish htm, project ### application, and applicatoin files folder - if that is what is supposed to be created there?
It says " could not find "C:\Documents and settings\name\local settings\apps\2.0\ etc....
Why is it looking there for the txt file?