How to Retreive Database Properties in a ProgramLast reviewed: April 30, 1996Article ID: Q130345 |
The information in this article applies to:
SUMMARYVisual FoxPro introduces several database properties available to databases. These properties include comments and stored procedures. This article describes how to determine database properties from a Visual FoxPro program.
MORE INFORMATIONThe DISPLAY DATABASE and LIST DATABASE commands can view several database properties at once. These commands can direct output to the console, to a printer, or to a text file. The example in this article retrieves individual components of a database.
CommentA database comment can be obtained by using the DBGETPROP() function. The following example shows how to return the comment of a database by using DBGETPROP():
cResult=DBGETPROP('mydata', 'DATABASE', 'Comment')The parameters are:
VersionThe version number of a database can be obtained by using DBGETPROP() function. The following example shows how to return the version number of a database by using DBGETPROP():
cResult=DBGETPROP('mydata', 'DATABASE', 'Version')The parameters are:
PathThe path to the database can be obtained by using the DBC() function. The following example shows how to return the path of a database by using DBC():
SET DATABASE TO alldata &&Assumes a database named "alldata" cResult=DBC() Stored ProceduresStored procedures contained within a database can be obtained by using the DISPLAY PROCEDURES or COPY PROCEDURES command. There is no way to store the contents of stored procedures in a memory variable. DISPLAY and COPY PROCEDURES can both be used to copy stored procedures to a text file or to the printer. The following example uses COPY PROCEDURES to copy the stored procedures to a file named STORCODE.TXT:
OPEN DATABASE alldata COPY PROCEDURES TO storcode.txt TablesA list of tables contained within a database can be obtained by using the DISPLAY TABLES or LIST TABLES command to display the list to the console, a printer, or a text file. Here's an example:
OPEN DATABASE alldata LIST TABLES TO FILE tblfile.txt NOCONSOLE ViewsA list of views contained within a database can be obtained by using the DISPLAY VIEWS or LIST VIEWS command to display the list to the console, a printer, or a text file. Here's an example:
OPEN DATABASE alldata LIST VIEWS TO FILE viewfile.txt NOCONSOLE Named ConnectionsA list of named connections contained within a database can be obtained by using the DISPLAY CONNECTIONS or LIST CONNECTIONS command to display the list to the console, a printer, or a text file. Here's an example:
OPEN DATABASE alldata LIST CONNECTIONS TO FILE connfile.txt NOCONSOLE |
Additional reference words: 3.00 VFoxWin
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |