Pergi ke kandungan

Visual FoxPro

Daripada Wikipedia, ensiklopedia bebas.

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

[sunting | sunting sumber]

Keserasian sistem operasi

[sunting | sunting sumber]
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 [1] No [2]
Windows 95 Yes Yes Runtime only No [3] 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[4] Yes Yes Yes Yes

Maklumat mengenai File Perlaksanaan

[sunting | sunting sumber]
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

[sunting | sunting sumber]
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

[sunting | sunting sumber]
* 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

[sunting | sunting sumber]
* 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

[sunting | sunting sumber]

Pautan luar

[sunting | sunting sumber]

Laman Microsoft

[sunting | sunting sumber]

Laman lain

[sunting | sunting sumber]
  1. ^ - VFP8 applications are not supported but can be run under Windows NT 4.0
  2. ^ - The free patch for VFP 9.0 has been created by the German FoxPro User Group (dFPUG) and is available at the dFPUG document portal in the directory http://portal.dfpug.de/dFPUG/Dokumente/Freeware/. It allows you to run VFP 9.0 applications on NT 4.0. Microsoft has indicated that this will be addressed in VFP 9.0 SP1.
  3. ^ - The second-level menus don't work under Windows 95.
  4. ^ Functionally works, however, performance is so slow that it is not worth the effort.[perlu rujukan]