Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sybase SQL Anywhere & Lockups
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00289514
Message ID:
00294935
Vues:
41
>What's a SQL Pass-through?
>

Instead of letting VFP create the SQL code to connect to the database, you can bypass it using SQL Pass-through. The views are "hiding" some of the things that normally happen behind the scenes. It's still pretty easy to use.

For example, here was part of my original code:
IF !USED('rv_estimatelist')
   USE rv_estimatelist IN 0 NODATA
ELSE
   SELECT rv_estimatelist 
ENDIF

=REQUERY()

Which became:

* Establish connection to ODBC

pnConnHandle = SQLCONNECT('Shoplnk')       && Name of the ODBC connection

* Note: the SELECT, if it's complex, might have to be broken into 
* multiple lines, then added together.

lcSelect = "SELECT Estimates.ClaimID, Estimates.EstimateID FROM SL60T.Estimates WHERE Estimates.ClaimID = " + lcClaim 

SQLEXEC(pnConnHandle,lcSelect,"spt_list")

* The cursor spt_list now contains the same info our view "rv_estimatelist" would have.

* Disconnect ODBC connection

SQLDISCONNECT(pnConnHandle)
There's more info in the VFP manual, but the above example includes everything needed for SPT. I did have problems with complex SQL statements and had to break them up to make it work.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform