I am puzzled about how to connect to a data source with VSE 2010. When I work with the SQL Server Compact database from the IDE, everything is fine, and the connection string displays as
C:\Documents and Settings\Al Bogus\My Documents\Visual Studio 2010\Projects\VERA\VERA\VeraDB.sdf and testing the connection works.
However when debugging, the program complains it cannot find the database file. The connection string in the program is derived from the app.config file which has this entry:
<add name="VERA.My.MySettings.VeraDBConnectionString" connectionString="Data Source=|DataDirectory|\VeraDB.sdf"
Debugging the program, that call My.Settings.VeraDBConnectionString results in:
Data Source=|DataDirectory|\VeraDB.sdf which tells me nothing, but when the program errors out it says it cannot find the database file at:
C:\Documents and Settings\Al Bogus\My Documents\Visual Studio 2010\Projects\VERA\VERA\bin\debug\VeraDB.sdf
leaving me to wonder why it is even looking there since at no time did I ever tell it that was the place to look for the database file.
So what am I missing? I am guessing a lot....do I need to replace |DataDirectory| with a hard coded value? Or is there some property of the project that establishes it?
Thanks in advance.