how to access msaccess db from application path, please give me solution urgently RRS feed

  • Question

  • User-114137219 posted

    Hi All, I am working winforms with c#.net and msaccess db. i have to access db from application folder i don't specify the directory staticwise. i have written code for accessing the db following that is Appconfig file. I have taken connection string from this. --------------------------- <configuration> <configsections> </configsections> <appsettings> <!-- <add key="ConnectStringToDB" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|IKON.mdb"/>--> <!-- <add key="ConnectStringToDB" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\IKON.mdb"/>--> <add key="ConnectStringToDB" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|App_Data\IKON.mdb;Persist Security Info=False"> </add> <connectionstrings> <add name="ConnectStringToDB" connectionstring="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|App_Data\IKON.mdb;Persist Security Info=False" providername="System.Data.OleDb"> </add> </connectionstrings> ------------- My DB is in the debug folder. I f i put the above code I am accessing the DB and Alse working when i am running the apllication. and i closed the application and run again but i am lossing the data when i inserted first time data. If i put the directory path in some specified directory(C,D,E) then my application is working fine. Please give the solution for Lossing the data. I thing I did't give the file directory correctly Please give the solution with code. Thanks in Advance.</appsettings></configuration>

    Wednesday, June 9, 2010 1:02 AM