I don't think what you are seeing is strange, unless I have misunderstood something. What you are seeing sounds exactly like the default VS behavior as described in the FAQ. The data source path is not supposed to change. You didn't mention what your connection string references for the database path, but I would assume it uses the DataDirectory keyword. That means that when the project is run, it will always use the copy of the database that's in the output folder. In order to make sure there is always a copy there, VS copies it when you run. This is a VS behavior, not ADO.NET or the .NET framework itself. That's why it works when you run outside of the de****, because the app will use the same file it's been using, which is the one in the output folder, but VS will not be there to make the copy before you start running.
You should see the MDB file itself copied. I don't know why the file date would remain the same. It's a simple operation, VS is not going to do any sophisticated data transfer to move the data over without changing the file itself.
Personally, I don't like the default behavior because it's confusing for just the reasons you are seeing, but you can change it by modifying the file properties in the solution as described in the FAQ. It happens with SQL Server Express MDF files too, so it's not a subliminal hint to move away from MDB.
Do you think you are running into something different than what's in the FAQ, or have you tried changing the "Copy to Output Directory" setting and it didn't help
Thanks, Sarah
|