Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Program does not find database
 

Program does not find database

I have written a program with a database attached. When I publish it on another computer and try to open up a form that reads from the database, I get an error message that the database is not found. When opening up the folders I find the database in another folder. After moving it to the folder the program looks for it works.

How can I correct this problem?
Moshe Y  Tuesday, June 23, 2009 7:30 PM
The database is SQLServer Express and it was set to include. By the way, it's either include or data, there is no include data. So that is no really the solution.
I'll check out your link.
  • Marked As Answer byMoshe Y Wednesday, June 24, 2009 3:48 PM
  •  
Moshe Y  Wednesday, June 24, 2009 5:24 AM

You don't say what kind of database -- Access? SQLServer Express? SQLCE?

When you add the database to your solution, ClickOnce flags it as a data file, and it puts it in the ApplicationDeployment folder instead of with the rest of the files. If you don't want to do this, open the Application File dialog and look for the file, and set it to "Include" instead of "Include(Data)". Note that when you deploy an update, it will replace the database if you have changed it at all. You should have "copy to output directory" set to "copy if newer" for sure.

You might want to check out this thread. It has a post from me (RobinS. or RobinDotNet) that has two links in it to other posts explaining some ideas in how to handle your data with a ClickOnce application.

http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/c8c55be6-be34-47cf-93fc-6cc0bf97f2cf

RobinDotNet


Click here to visit my ClickOnce blog!
RobinDotNet  Wednesday, June 24, 2009 4:00 AM
The database is SQLServer Express and it was set to include. By the way, it's either include or data, there is no include data. So that is no really the solution.
I'll check out your link.
  • Marked As Answer byMoshe Y Wednesday, June 24, 2009 3:48 PM
  •  
Moshe Y  Wednesday, June 24, 2009 5:24 AM
After checking the application file dialog, I did the opposite of what you advised. The database was marked include and I changed it to Data and then it deployed successfully.
Moshe Y  Wednesday, June 24, 2009 3:48 PM
That works fine, but don't forget that it will redeploy a new version of it if you change the one in your project in VS, even if it's just to check out the structure or something like that. This is mentioned in the link above. It's a good thing to know. :-)

RobinDotNet
Click here to visit my ClickOnce blog!
RobinDotNet  Friday, July 31, 2009 8:44 AM

You can use google to search for other answers

Custom Search

More Threads

• Windows Installer: Filtering Content Files Output
• Connection to SqlServer 2000 failed
• How do i convert an Exe file to one other msi
• ClickOnce Updates?
• Click once launch problem
• Where are the sources of the localized installation dialog boxes?
• What upgrade is needed to publish
• Need help with Click Once Deployment settings
• Publish wizard don't work
• Tracking down URLDownloadToCacheFile failed