Beruflich Dokumente
Kultur Dokumente
All of the following FoxPro Commands Can Be Entered Into The Command Window (See Below) (these commands are not case sensitive)
quit - Exit
Database
Quit <-- quit will exit the FoxPro software. All database files and indexes are automatically saved. set default to - Assign
Default Drive/Directory
Set Default To Drive:Path <-- sets the default directory to the specified directory. A database application is generally formed by many files. In order to avoid problems while learning FoxPro, it is essential to place all of the files in an application in the same directory. Setting the default directory should be one of the first things you do. Create the directory using Windows. Set Default To A:\Client <-- set the default directory to be Client [ at the root of the floppy disk in the A drive]. Set Default To C:\346\Demo <-- set the default directory to be Demo [inside the 346 directory which is at the root of the C hard drive. create - Create
A New Database
create FileName <-- create a new database file. The create command dumps you into the file creation program where you are given the opportunity to determine the database structure/layout. You will select field names, field types (Character, Logical, Date, Currency, Numeric, and Memo, etc.), and field size. Create Client <-- create a database, called Client.DBF, in the default directory. Create C:\305\Client <-- create a database, called Client.DBF, in the 305 directory on the C hard drive. You can establish the directory path, but it is much better to set the default directory and allow all files to be automatically grouped together in this default directory
When a new database is constructed, each field must have a symbolic name by which it can be referenced. These field names are 1-10 characters in length. The field name may be constructed from any characters in the set {A,B,C,...,Z,Underscore(_)}. Field names are not case sensitive. Associated with each field will be a datatype. The datatypes that we will explore will be character, numeric, logical, date, and memo. Select a datatype that best fits the type of information that you plan to process. The character and numeric datatypes require that you specify the number of characters that are to be stored. The Client.DBF has been created below.
The default directory has been set to folderC:|Client. The tab key is used to advance to the next block when deciding upon the fields. The 9 fields of the Client database table (Client.DBF) have now been chosen for the database structure. Select the titles for these fields wisely. When finished designing the layout, use the mouse and select/press OK. When asked "Input Data Records Now", select/push the YES button. (See Below)
This will dump you into a crude data entry editor. Just for practice, try entering a few records.
Valid information for logical fields can be Y or y (Yes), N or n (No), T or t (True), F or f (False). Valid information for Numeric fields can be +,-,0,1,2,3,4,5,6,7,8,9. Valid information for character fields can be any keyboard characters. Valid information for the date field can be legal values in the form XX/XX/XX (the editor will provide the /'s). The Notes field is a memo field; the memo note has memo in lower case; this tells us that there has been no memo information recorded for this file. In order to record memo information with this crude data entry editor, double click on the word memo with your mouse. This will bring up an editing box.
Using the mouse, press/select the button to close the editing box; all changes will be saved. Press the ESC key to discard the memo changes. Note that Memo becomes capitalized once Notes contains some information. (See Below)
The database record information is updated when you fill a field, when you hit the tab key, and when you hit the enter key. You may add as many records as you like. When finished adding records and wish to cancel/abort the editor, hit the ESC key.
Examination of the A:\Client folder reveals 2 files. The database table information is contained in Client.DBF. The memo information is stored in the corresponding FPT file, called Client.FPT.
Fields
List [fields] <-- an uninterrupted display of database information. The list command will always move the read/write pointer to first logical record and display all of the fields of all records. Upon completion, the read/write pointer will always reside at the end of the file. Since the display is uninterrupted, there will be no pause when the screen is full. List <-- uninterrupted display of specified fields of all records.
The name of the database open in the active work area (Client) is specified in the left corner of the FoxPro status bar. The path to that database (C:\Client\Client.DBF) is specified on the left side of the FoxPro status bar. The status bar specifies that there are 3 records in the database. We will discuss the read/write pointer in FoxProB; the status bar specifies that the read/write pointer is at EOF (End Of File). The status states that this database is not shared, it is opened exclusively for one user. List Name, State, Phone <-- uninterrupted display of the Name field, the State field, and the Phone of all records. List Phone, Name, State <-- uninterrupted display of the Phone field, the Name field, and the State field of all records. list to print - Print
List Name, Phone To Print <-- uninterrupted display and printing of the Name field and the Phone of all records. List Phone, Name, State To Print <-- uninterrupted display of the Phone field, the Name field, and the State field of all records. append - Add
Append <-- move the read/write pointer to the end of the file and evoke a very crude editor for data entry. Append is used to add additional records to the database.
display structure -
Display Structure <-- display the database layout, the number of records, and the creation date. It will pause when the screen is full. Structure for table : C:\Client\client.DBF Number of records : 100 Date of last update: 01/01/98 Memo file block size: 64 Code Page: 1252
Field Field Name Type Width Dec 1 NAME Character 26 2 ADDRESS Character 30 3 CITY Character 16 4 STATE Character 2 5 ZIP Character 8 6 PHONE Character 12 7 MALE Logical 1 8 NO Numeric 4 0 9 NOTES Memo 4 ** Total ** 104 list structure -
List Structure <-- display the database layout, the number of records, and the creation date. It will not pause when the screen is full. Structure for table : C:\Client\client.DBF Number of records : 100 Date of last update: 01/01/98 Memo file block size: 64 Code Page: 1252 Field Field Name 1 NAME 2 ADDRESS 3 CITY 4 STATE 5 ZIP 6 PHONE 7 MALE 8 NO 9 NOTES ** Total ** Type Character Character Character Character Character Character Logical Numeric Memo Width 26 30 16 2 8 12 1 4 4 104 Dec
List Structure To Print <-- display and print the database layout, the number of records, and the creation date. It will not pause when the screen is full. display structure to print -
Display Structure To Print <-- display and print the database layout, the number of records, and the creation date. It will pause when the screen is full. The difference between List Structure To Print and Display Structure To Print is only the pause when the screen is full. use -
Open Database
use FileName <-- close any database open in the current work area and opens the specified database. The database must have a .DBF extension. The read/write record pointer is positioned at the first record when file is opened/re-opened. Use Client <-- close and database open in the current work area and then open database file Client.DBF in the current work area.
Use Students <-- close and database open in the current work area and then open database file Students.DBF in the current work area. Use <-- close any database open in the current work area. clear -
Clear Console