***Selamat Datang***

Laman

Minggu, 05 Desember 2010

Visual Foxpro

"Bahasa Pemograman Yg Saya Pelajari swaktu Kuliah duLu & saat ini Saya Pake di Tempat Kerja (Aplikasi Keuangan)"

Yaitu... Visual FoxPro...



PengeRtian VisuaL Foxpro sendiri adalah sebuah object-oriented dan prosedural data-sentris bahasa pemrograman yang diproduksi oleh Microsoft. Hal ini berasal dari FoxPro (awalnya dikenal sebagai FoxBASE) yang dikembangkan oleh Fox Software dimulai pada tahun 1984. Fox Technologies bergabung dengan Microsoft pada tahun 1992, setelah mana perangkat lunak mengakuisisi fitur lebih lanjut dan awalan "Visual". Versi terakhir FoxPro (2.6) bekerja pada Mac OS, DOS, Windows, dan Unix: Visual FoxPro 3.0, yang pertama "Visual" versi, mengurangi dukungan platform untuk Mac dan Windows, dan versi adalah Windows-saja. Versi saat ini dari Visual FoxPro adalah berbasis COM dan Microsoft telah menyatakan bahwa mereka tidak berniat untuk membuat versi Microsoft BERSIH..

FoxPro berasal sebagai anggota kelas bahasa sering disebut sebagai "xbase" bahasa, yang memiliki sintaks berdasarkan bahasa pemrograman dBase. Anggota lain dari rumpun bahasa xbase termasuk Clipper dan Recital. (Sebuah sejarah tahun-tahun awal xbase dapat ditemukan di artikel dBase.)

Visual FoxPro, biasa disingkat VFP, terintegrasi dengan mesin database relasional sendiri, yang memperluas kemampuan xbase FoxPro untuk mendukung SQL query dan manipulasi data. Tidak seperti sistem database yang paling manajemen, Visual FoxPro adalah, fitur lengkap bahasa pemrograman dinamis yang tidak memerlukan penggunaan lingkungan pemrograman tambahan tujuan umum. Hal ini dapat digunakan untuk menulis tak hanya tradisional "klien lemak" aplikasi, tetapi juga middleware dan aplikasi web.


Contoh kode
Hello World example:
MESSAGEBOX("Hello World")

Object



Output of the Hello World program.
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. (Double-ampersand marks an end-of-line comment)
? 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, calling a hidden method that returns
* the value of a hidden property.
RETURN This.MyMethod2()
ENDPROC

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

Data handling
&& 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 ordered data using xBase-style commands
USE randData
SET ORDER TO iData
GO TOP
LIST NEXT 10 && First 10
SKIP 81
LIST NEXT 10 && Last 10
CLOSE ALL

&& Browse ordered 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 command
LOCAL nResult
nResult = SQLEXEC (nHnd, "USE master")
IF nResult < 0
MESSAGEBOX ("MASTER database does not exist!")
RETURN
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)

Cuma sedikit yG bisa saya sampaikan dari pengertian sampe contoh kode VisuaL FoxPro,,,

Tidak ada komentar:

Posting Komentar