Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A pseudo SEEK() Function to be used with SPT
Message
From
05/07/2002 08:54:46
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
A pseudo SEEK() Function to be used with SPT
Miscellaneous
Thread ID:
00675579
Message ID:
00675579
Views:
75
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
Next
Reply
Map
View

Click here to load this message in the networking platform