Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A pseudo SEEK() Function to be used with SPT
Message
De
05/07/2002 08:54:46
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
A pseudo SEEK() Function to be used with SPT
Divers
Thread ID:
00675579
Message ID:
00675579
Vues:
74
Hi,

I'm new to Client-Server programming and sometimes would like to use standard VFP code to perform some simple tasks when using SQL Pass Thru, but unfortunatelly I can't (many folks asked it many times to MS, OTOH many other folks, many other times said it was unnecessary!).

An example: to check if a specific record exists, just that (a parts item in an inventory, a client by its code etc) and based on the result make a decision.

That's very simple when using DBFs (please see "Standard VFP DML Code" below), but when using SPT I must code a SQL Select and all that "surrounding" code (there is a better way?), so I wondered if it would be a good idea to create a general purpose UDF to do that (please see "Code to be Used With SPT" below).

It's just a prototype idea, and I ask you, please, to help me by making your comments, they'll be very appreciated.
 Standard VFP DML Code:
 ---------------------
 
 If Seek (eExpression, cTableAlias)
    ...
 endif

 Code to be Used With SPT:
 ------------------------
  
 If SQLSeek (nHandle, "Customer", "CustNo = 77")  &&  SQLSeek example call
    ...
 endif

 Procedure SQLSeek    &&  The pseudo SEEK() Function
*--------- ------- 
 LParameters pHandle   , pTable, pWhereCondition
 Local       cSelectStr, bFound

 cSelectStr = " Select * From " + pTableName + 
              IIf (! Empty (pWhereCondition), " Where " + pWhereCondition, "")

 SqlExec (pHandle, cSelectStr, "CurSQLSeek")
 
 Select CurSQLSeek
 
 bFound = RecCount () > 0

 Use In CurSQLSeek

 Return bFound

 EndProc
TIA

Fernando
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform