Visual FoxPro is an actively used programming language created in 1995.

24Years Old 7,280Users 33Jobs

Example code from Wikipedia:

PRIVATE cAuthorID, cAuthorName      && Private variables supplant any previous global or private variable of the same name
 LOCAL nHnd, nResult                 && Local variables are visible only here

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

 * Enter a loop so we can exit to the close connection code if there's an error
 DO WHILE .T.
     * Execute a SQL command
     nResult = SQLEXEC (nHnd, "USE master")
     IF nResult < 0
         MESSAGEBOX ("MASTER database does not exist!")
         EXIT  && To close the connection
     ENDIF

     * Retrieve data from the remote server and stores it in a local data cursor
     nResult = SQLEXEC (nHnd, "SELECT * FROM authors", "QAUTHORS")
     IF nResult < 0
         MESSAGEBOX ("Unable to execute remote SQL SELECT command!")
         EXIT  && To close the connection
     ENDIF

     * Update a record in a remote table using parameters
     cAuthorID     = "1001"
     cAuthorName   = "New name"
     nResult       = SQLEXEC (nHnd, "UPDATE authors SET auth_name = ?cAuthorName WHERE auth_id = ?cAuthorID")
     IF nResult < 0
         MESSAGEBOX ("Unable to execute remote SQL UPDATE command!")
         EXIT  && To close the connection
     ENDIF

     * If we get here, we have retrieved everything successfully
     EXIT  && Exit unconditionally
 ENDDO

 * Close the connection
 SQLDISCONNECT(nHnd)
Edit

Last updated February 11th, 2019