Visual FoxPro is a programming language created in 1995.
|#306on PLDB||28Years Old||1.5kUsers|
Visual FoxPro is a discontinued data-centric, object-oriented, procedural, programming language produced by Microsoft. It was derived from FoxPro (originally known as FoxBASE) which was developed by Fox Software beginning in 1984. It contained the fastest PC-based database engine available at the time. Read more on 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)