Tip of the Month (May 2002)
Changing the Location of a Database Volume (a .CDB or .SDF File)
When you first create a form, you are asked whether the form works against a table in the Windows CE Store or a Database Volume. If you specify Database Volume, you select a .CDB or .SDF file on the handheld. The full pathname of the database volume file is saved inside the .VCE form.
If the database volume moves on the handheld, you will no longer be able to open the .VCE form in Visual CE's desktop development environment (since Visual CE won't be able to find the database volume). You will need to save the new location of the database volume inside the .VCE form.
How to save the new location of the database volume inside the .VCE form is explained below, but first, some background information...
On the handheld, when you open a .VCE form built on a database volume, it ignores the path of the database volume that is saved in the .VCE file. It just uses the simple filename. Visual CE looks for a database volume with that simple filename in the same folder as the .VCE file.
Example: Say, on the handheld, you have a SQL Server CE database called MyDatabse.SDF in the \My Documents folder and you create MyForm.VCE over that database. "\My Documents\MyDatabase.SDF" would be saved inside MyForm.VCE, and MyForm.VCE would be in \My Documents also. If you moved MyDatabase.SDF to a \My Documents\NewLocation folder, all you have to do is move MyForm.vce file to the \My Documents\NewLocation folder. Visual CE (on the handheld) will find MyDatabase.SDF in its new location when you open MyForm.VCE in its new location.
So, to save the new location of a database volume inside a .VCE form, just open up the form in the development environment ON THE HANDHELD and immediately do a FILE | SAVE. The new full pathname of the database volume will be saved inside the .VCE form.