How to Assign Database Location Generically in Data EnvLast reviewed: January 2, 1998Article ID: Q128996 |
3.00 5.00
WINDOWS
The information in this article applies to:
SUMMARYThe Data Environment contains information about all the tables, views, and relationships that interact with a form. In the Form Designer, when a table is added to the data environment, the database property of a cursor is updated with the location and name of the DataBase container (.DBC), and the path written in the DataBase property is set by default as an absolute path. If the database cannot be found when the form is opened, the error "Error instantiating cursor object. Cannot find ..<database>" is displayed. The sample code provided in this article modifies the path information written in the Database property to fit your needs.
MORE INFORMATIONWhen a table is added to the Data Environment in the Form Designer, a cursor object is created. If the table belongs to a DBC, the DataBase property of the cursor is updated with the full path name to the DBC. However, the absolute path to a DBC might need to be modified in a distributed application. For example, multiple users can open databases with the same name that are placed in different locations. If you need to reference a different database than the one specified in the Database property of the Cursor object, you can use the SET PATH command, before the program calls the form, to set a path to the location of the database. If the database specified in the DATABASE property of the Cursor cannot be found, Visual FoxPro will search along the path. Another alternative is to update the DATABASE property at runtime. The following example adds flexibility to your code by updating the path information in the Database property of the cursor object. This code can update the location of different databases referenced in the Data Environment. As this sample only references one directory, you will need to modify it if you need to open databases in several directories. To use this example:
|
Additional reference words: 5.00 3.00 VFoxWin
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |