|
-
Jul 16th, 2009, 04:20 PM
#1
Thread Starter
Addicted Member
Question about adding a DB file to your project....
I read the FAQ about how when you add a datasource and it asks you if you want to copy the file to your project, if you say yes then it won't actually update the original file. At least that's what I remember, and it seems to be the case here.
My question is is there a way to undo that without deleting the data source and re-adding it, this time telling it not to add the file to your project?
-
Jul 16th, 2009, 09:22 PM
#2
Re: Question about adding a DB file to your project....
Why exactly would you not want to add the file to your project? I'm guessing that you don't fully understand the implications of using local data files because not updating the original file is a good thing. I suggest that you follow the first link in my signature to see how to manage a local data file.
In general, you should add the file to your project and then set its Copy to Output Directory property to Copy if Newer. That will allow you to debug repeatedly with the same test data and only wipe that data out when you update the schema of the database. If you want to force the database to be refreshed from the source you set Copy to Output Directory property to Always Copy, build and then set it back.
-
Jul 17th, 2009, 09:21 AM
#3
Thread Starter
Addicted Member
Re: Question about adding a DB file to your project....
Ok so from what I read, "Copy If Newer" will allow me to see changes I make next time I run the program, and "Always Copy" won't. They don't recommend "Copy If Newer" because it can be marked as newer just by looking at it in the explorer.
Even if I pick the MDF file and tell it to Copy If Newer my changes aren't visible next time I run the program though. I can go to the "bin" folder and see the project database file has been updated though.
-
Jul 17th, 2009, 10:51 AM
#4
Re: Question about adding a DB file to your project....
Correct... you have three options:
1) Never Copy - so if you make changes to the DB from the designer, the changes will be made to the PROJECT'S copy... but when you run it, the one in the BIN folder WON'T have those changes.
2) Copy if Newer - solves this problem by copying the database file from the Project folder to the BIN folder if it's been changed (based on the file's TimeStamp). But any changes to the data previously done will be lost.
3) Always copy - No matter what, always copy over the database file, changes or no. This ensures that the database structure at least is always up to date... but again, over writes any data changes.
-tg
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
|