Link to home
Start Free TrialLog in
Avatar of Dov_B
Dov_B

asked on

after I publish my application and run it it cannot find my database file

when I test it from the code that application connects to the database with :
constring = "Data Source=" & My.Application.Info.DirectoryPath & "\Database1.sdf;Persist Security Info=False;"
but when I publish it and try to run the published version I get an error and it says to check the path
Avatar of Luis Pérez
Luis Pérez
Flag of Spain image

First, check that the database file is present at run-time.
Second, try Application.StartupPath instead of My.Application.Info.DirectoryPath.

If nothing of this works, please post the complete code of the exception thrown.
ASKER CERTIFIED SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dov_B
Dov_B

ASKER

may you be blessed thankyou thankyou thankyou
it was set as auto I changed it to included and then it worked by the way why was that necessary
You have to tell the publish process that you will use that. and that will be published.
Example, you sometimes work with local SQL databases but then when you deploy your application the database is running on the server. You don't need to include that on your project! If you really want you have to tell that.