简体   繁体   中英

all records in access 2007 deletes each time i run my visual studio c# application

Have som problem with Access 2007, and visual studio 2008 C#. each time i try to run my program deletes all records in access. the fields are still there but only records disappears!!! conn.accdb exist in my solution explorer with

path : C:\\Documents and Settings\\kizmo\\Dokumenter\\Visual Studio 2008\\Projects\\conn\\conn\\conn.accdb

Here i have another copy of conn.accdb and this is the one which all records deletes after running...... C:\\Documents and Settings\\kizmo\\Dokumenter\\Visual Studio 2008\\Projects\\conn\\conn\\bin\\Debug

i am not sure why i have to have 2 exactly samme database file i different directories.

thx

Sounds like the database file has been included in your project as "Copy to Output Directory". Your application is modifying the one in the bin directory, but everytime you compile, your blank database overwrites it. In the properties for that file in your project, turn off the "Copy to Output Directory" option. (You will then probably have to to change the path to the database.)

Also note that what you are seeing isn't necessarily bad in development. Your actual application, I'm assuming, will not be using the database in your Visual Studio bin folder, but somewhere else. Typically you use the ConnectionString node in your app.config to direct this to the correct location.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM