|
-
Jun 10th, 2009, 09:33 PM
#1
Thread Starter
Lively Member
pls help. problem with mdf file location.
hi all, my vb program r connected to mdf file to allow update,view n delete of database data. the mdf file is located at the \bin folder.
the problem is whenever i run the program, it will automatic copy the mdf file from the \bin folder to \bin\Debug\bin folder.
all the update n delete is then done on the mdf file located at \bin\Debug\bin.
when i run the program again, it will copy the mdf file from \bin and overwrite the mdf file at \bin\Debug\bin.
i try to delete the mdf file at \bin folder but error saying "unable to copy mdf from \bin to \bin\Debug\bin".
anyone know any solution? thanks
-
Jun 10th, 2009, 09:44 PM
#2
Re: pls help. problem with mdf file location.
The file should not be in the bin folder. It should be in the project folder, above the bin folder, along with all the other source files. When you build your project a copy is made and placed in the bin\Debug or bin\Release folder, along with the other output, and it's that copy that your app uses. Follow the first link in my signature for more information about how to configure that behaviour.
-
Jun 10th, 2009, 10:17 PM
#3
Thread Starter
Lively Member
Re: pls help. problem with mdf file location.
 Originally Posted by jmcilhinney
The file should not be in the bin folder. It should be in the project folder, above the bin folder, along with all the other source files. When you build your project a copy is made and placed in the bin\Debug or bin\Release folder, along with the other output, and it's that copy that your app uses. Follow the first link in my signature for more information about how to configure that behaviour.
hi, to place the mdf file in the bin folder is a requirement from my lecturer. however, i found out another solution. go to the properties for the mdf file. under Copy to Output Directory, select Copy if Newer. this help, but anyway, thanks for ur solution too.
-
Jun 10th, 2009, 10:44 PM
#4
Re: pls help. problem with mdf file location.
If placing the database in the bin folder is a requirement then you should probably be setting Copy to Output Directory to Copy Never and then specifying the absolute path of that file in your connection string.
If putting the database in the bin folder is really what your lecturer wants and not your misinterpretation of their instructions then I think that that's a very bad idea, and you can quote me on that. It offers no advantage over placing the database in the project folder during development and it creates a handicap when deploying, because your absolute path will no longer be valid. If you do it the way it's intended to be done then it will just work, during development and once deployed, with no changes.
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
|