Visual FoxPro

**Visual FoxPro** ialah sebuah bahasa pengaturcaraan bertatacara dan berorientasi objek berpusatkan data (*data-centric*) yang dikeluarkan oleh Microsoft. Ia terhasil daripada FoxPro (pada asalnya dikenali sebagai **FoxBASE**) yang dimajukan oleh Fox Software pada awal 1984. Fox Technologies bergabung dengan Microsoft pada 1992 dan atur caranya mendapat ciri-ciri tambahan dan awalan "Visual". Versi terakhir FoxPro (2.6) boleh dilaksanakan menggunakan sistem pengendalian Mac OS, DOS, Windows, dan UNIX: Visual FoxPro 3.0, versi "Visual" pertama, menyingkir sokongan pelantar hanya kepada Mac dan Windows, dan versi berikutnya hanya pelantar Windows sahaja. Versi terkini Visual FoxPro adalah berasaskan COM dan Microsoft telah menyatakan bahawa mereka tidak berniat untuk mencipta versi Microsoft .NET.

FoxPro adalah ahli kepada bahasa dalam kelas yang biasanya dirujuk sebagai bahasa "xBase", di mana sintaksnya berasaskan bahasa pengaturcaraan dBase. Ahli lain keluarga bahasa xBase termasuk Clipper dan Recital. (Sejarah awal xBase boleh di lihat dalam rencana dBASE.)

Visual FoxPro, biasanya diringkaskan sebagai VFP, biasanya dianggap umum sebagai hanya sistem pengurusan pangkalan data - *database management system* (DBMS). Ini menidakkan fakta bahawa ia merangkumi bukan hanya enjin DBMS, tetapi juga ciri penuh bahasa pengaturcaraan. Ia boleh digunakan bukan sahaja untuk menulis perisian pelanggan gemuk - *fat client*, tetapi juga bagi *middleware* dan penggunaan web.

## Maklumat versi
### Keserasian sistem operasi

  **Supported Windows Versions**
    
      Version
      VFP 5.0
      VFP 6.0
      VFP 7.0
      VFP 8.0
      VFP 9.0
    
    
      Windows NT 4.0
      Yes
      Yes
      Yes
      No 
      No 
    
    
      Windows 95
      Yes
      Yes
      Runtime only
      No 
      No
    
    
      Windows 98
      Yes
      Yes
      Yes
      Runtime only
      Runtime only
    
    
      Windows ME
      Yes
      Yes
      Yes
      Runtime only
      Runtime only
    
    
      Windows 2000
      Yes
      Yes
      Yes
      Yes
      Yes
    
    
      Windows XP
      Yes
      Yes
      Yes
      Yes
      Yes
    
    
      Windows 2003
      ?
      Yes
      Yes
      Yes
      Yes
    
    
      Windows Vista
      See Note
      Yes
      Yes
      Yes
      Yes
    


### Maklumat mengenai File Perlaksanaan


VersionVERSION() returnsEXE SizeEXE Date
DLL SizeDLL Name

VFP 9Visual FoxPro 09.00.0000.2412 for Windows
 5,620 kb13-DEC-2004
4,600 kbVFP9R.DLL

VFP 8Visual FoxPro 08.00.0000.3117 for Windows
 5,236 kb25-SEP-2003
4,200 kbVFP8R.DLL

VFP 7Visual FoxPro 07.00.0000.9465 for Windows
 4,260 kb04-JAN-2002
3,344 kbVFP7R.DLL

VFP 6Visual FoxPro 06.00.8961.00 for Windows
 4,091 kb18-AUG-2000
3,295 kbVFP6R.DLL 

VFP 5Visual FoxPro 5.0.0.344
4,072 kb20-AUG-1996
3,146 kbVFP500.DLL

VFP 3Visual FoxPro 03.00.00.0711 for Windows
4,374 kb16-DEC-1995
3,657 kbVFP300.ESL

FPW 2.6aFoxPro 2.6a for Windows
2,444 kb28-SEP-1994
n/an/a


## Contoh kod
### Objek

```
loForm = CREATEOBJECT("HiForm")
loForm. Show(1)

DEFINE CLASS HiForm AS Form
  AutoCenter = .T.
  Caption = "Hello, World"

  ADD OBJECT lblHi as Label WITH ;
    Caption = "Hello, World!"
ENDDEFINE
```



```
loMine = CREATEOBJECT("MyClass")
? loMine.cProp1   && This will work.
? loMine.cProp2   && Program Error: Property CPROP2 is not found.

? loMine. MyMethod1()  && This will work.
? loMine. MyMethod2()  && Program Error: Property MYMETHOD2 is not found.

DEFINE CLASS MyClass AS Custom
  cProp1 = "My Property"    && This is a public property
  HIDDEN cProp2     && This is a private (hidden) property

  PROCEDURE Init()    && Class constructor
    This.cProp2 = "This is a hidden property."
  ENDPROC

  PROCEDURE MyMethod1()   && This is a public method
    RETURN This. MyMethod2()
  ENDPROC

  HIDDEN PROCEDURE MyMethod2()  && This is a private (hidden) method
    RETURN This.cProp2
  ENDPROC
ENDDEFINE
```


### Pengendalian data

```
* Create a table
CREATE TABLE randData (iData I)

* Populate with random data using xBase and SQL DML commands
FOR i = 1 TO 50
        APPEND BLANK
        REPLACE iData WITH (RAND() * 100)

  INSERT INTO randData (iData) VALUES (RAND() * 100)
ENDFOR

* Place a structural index on the data
INDEX ON iData TAG iData
CLOSE ALL

* Display sorted data using xBase-style commands
USE randData
SET ORDER TO iData
GO TOP
LIST NEXT 10  && First 10 (end-of-line comment)
SKIP 81
LIST NEXT 10  && Last 10
CLOSE ALL

* Browse sorted data using SQL DML commands
SELECT * ;
  FROM randData ;
  ORDER BY iData DESCENDING
```


### ODBC Access using SQL Passthrough

```
* Connect to an ODBC data source
LOCAL nHnd
nHnd = SQLCONNECT ("ODBCDSN", "user", "pwd")

* Execute a SQL ccommand
LOCAL nResult
nResult = SQLEXEC (nHnd, "USE master")
IF nResult < 0
  MESSAGEBOX ("MASTER database does not exist!")
ENDIF

* Retrieve data from the remote server and stores it in
* a local data cursor
nResult = SQLEXEC (nHnd, "SELECT * FROM authors", "QAUTHORS")

* Update a record in a remote table using parameters
LOCAL cAuthorID, cAuthorName
cAuthorID = "1001"
cAuthorName = "New name"
nResult = SQLEXEC (nHnd,"UPDATE authors SET auth_name = ?cAuthorName WHERE auth_id = ?cAuthorID")

* Close the connection
SQLDISCONNECT(nHnd)
```


## Nama kod Beta
* VFP 3 - Taz
* VFP 5 - RoadRunner
* VFP 6 - Tahoe
* VFP 7 - Sedona
* VFP 8 - Toledo
* VFP 9 - Europa
* VFP Next - Sedna

## Pautan luar

* Microsoft puts FoxPro out to Pasture

### Laman Microsoft
* Main Visual FoxPro Microsoft page
* MSDN FoxPro support board 
* VFP's online help file
* Microsoft VFP 9 support
* Visual FoxPro Essential Downloads page

### Laman lain
* Visual FoxPro Wiki The biggest repository of FoxPro information (written in VFP)
* Board to get help for Visual FoxPro in English, Spanish, Portuguese and French
* A site devoted to the history of FoxPro
* ActiveVFP  Open Source, free FoxPro web development framework
* Visual FoxPro news, updated regularly
* Foxstuff (collection of technical articles relating to Visual FoxPro)
* FoxPro Summary for quick references and beginners 
* Hentzenwerke Publishing - noted publisher of books on Visual FoxPro
* Virtual FoxPro User Group - free online support resource
* ProFox mailing list
* Introduction and tutorial
* Active FoxPro Pages FoxPro based replacement for ASP
* Programming Windows OS in Visual FoxPro Online reference
* www.foxite.com Free online Visual FoxPro Community
* VFPx A Visual FoxPro Community effort to create open source add-ons for VFP 9.0

## Rujukan