|
-
Jan 4th, 2022, 03:39 AM
#1
Thread Starter
Banned
How to include mdb file inside vb.net Application
Dear All
I have a vb.net application connected to access database which is inside the Application Under the debug Folder , when I add this database as existing item it copies it to another path ?
then I have 2 copies of the database one inside the debug folder which updates data and runs OK and another copy outside the debug folder which does not update data
what should I do to have one database which updates data not two.
Also, when I remove the outside database the application does not find the database ?
What is the solution to this ?
I tried Content and Do not copy , copy always , copy if newer
Nothing works
Thanks in Advance, Regards
Moheb Labib
Last edited by meho2020; Jan 4th, 2022 at 04:17 AM.
-
Jan 4th, 2022, 10:19 AM
#2
Re: How to include mdb file inside vb.net Application
It's working properly and you're trying to break it. The data file should not be in the bin folder to start with. It should be created in your project folder or somewhere completely outside the project. You then add the data file as an existing item to your project. If the file is outside the project folder, you will be prompted to copy it to the project folder, which you should do. You now have your data file in your project, with the other source files.
When you build your project, that source file is copied and saved to the output folder. It is that copy that your application should connect to when you are testing/debugging. You can make as big a mess of that copy as you want to, safe in the knowledge that your original source file is still in its pristine state. By default, the Copy to Output Directory property will be set to Copy Always. That means that any time your project is built, a new copy is created in the output folder and you will lose any changes you made the last time you debugged. That's generally not what you want. If you change it to Copy if Newer then a new copy will only be created if you make changes to the original source file, e.g. change the schema or add new initial data.
Because your source file remains clean, when it comes time to deploy your app, you create a Release build and you'll get a fresh copy of the data file in that output, so there's no need to clean all your test garbage out to release.
You might like to follow the first link in my signature for a bit of official information on the subject from Microsoft.
-
Jan 5th, 2022, 02:13 AM
#3
Thread Starter
Banned
Re: How to include mdb file inside vb.net Application
Dear jmcilhinney
Thanks your reply, Regards
Moheb Labib
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|