SQL SELECT is one of the most versatile command available to Visual FoxPro 
programmer

SELECT [ALL | DISTINCT] [TOP nExpr [PERCENT]] Select_List_Item [, ...]
   FROM [FORCE] Table_List_Item [, ...]
      [[JoinType] JOIN DatabaseName!]Table [[AS] Local_Alias]
      [ON JoinCondition [AND | OR [JoinCondition | FilterCondition] ...] 
   [WITH (BUFFERING = lExpr)]
   [WHERE JoinCondition | FilterCondition [AND | OR JoinCondition | 
FilterCondition] ...]
   [GROUP BY Column_List_Item [, ...]] [HAVING FilterCondition [AND | OR ...]]
   [UNION [ALL] SELECTCommand]
   [ORDER BY Order_Item [ASC | DESC] [, ...]]
   [INTO StorageDestination | TO DisplayDestination]
   [PREFERENCE PreferenceName] [NOCONSOLE] [PLAIN] [NOWAIT]
Retrieves data from one or more tables. When you use SQL SELECT to create a 
query, Visual FoxPro parses the query and retrieves the specified data from the 
tables. You can create a SQL SELECT query from the Command window, in a Visual 
FoxPro program

After a select is made, the cursor remains open only for reading. so can it be 
modified again and again?"
There is a READWRITE clause in VFP from ver 7, if that's what you are using, 
that enables you to create the cursor as writeable:
SELECT * FROM MyTable ;
WHERE .... ;
INTO CURSOR SomeCursor ;
READWRITE

But if you are using earlier versions of VFP, you can do something like:
SELECT * FROM MyTable ;
WHERE .... ;
INTO CURSOR SomeCursor 
SELECT 0
USE DBF('SomeCursor') AGAIN ALIAS NewAlias
Select cannot be used to open a table.  A table must be opened first ( via the 
Use command is one way but there are others. ) and SELECT allows you to 
returned to an already open table.
VFP can have many tables open at one time; each table is contained in a 
workspace
http://weblogs.foxite.com/andykramek/archive/2005/09/18/921.aspx


CLOSE ALL
CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\TestData')
SELECT TAlias1.company, TAlias2.order_date, TAlias2.shipped_on ;
   FROM customer TAlias1, orders TAlias2 ;
   WHERE TAlias1.cust_id = TAlias2.cust_id ;
   INTO TABLE custship.dbf
BROWSE



*!* This sample uses the Customer table in:
*!* VFP 3/5 -- HOME() + "Samples\Data"
*!* VFP 6 -- HOME(2) + "Data"
SET TALK OFF     && stop echo to screen
x="Country"
y="UK"
SELECT * ;
   FROM CUSTOMER;
   HAVING EVALUATE(x)=(y);
   INTO CURSOR crsrUK
BROWSE


Fox will access to odbc with sql parameter but imo this is a different argument
&& Connect to an ODBC data source
LOCAL nHnd
nHnd = SQLCONNECT ("ODBCDSN", "user", "pwd")
 
&& Execute a SQL command
LOCAL nResult
nResult = SQLEXEC (nHnd, "USE master")
IF nResult < 0
  MESSAGEBOX ("MASTER database does not exist!")
  RETURN
ENDIF
 
&& Retrieve data from the remote server and stores it in
&& a local data cursor
nResult = SQLEXEC (nHnd, "SELECT * FROM authors", "QAUTHORS")
 
&& Update a record in a remote table using parameters
LOCAL cAuthorID, cAuthorName
cAuthorID = "1001"
cAuthorName = "New name"
nResult = SQLEXEC (nHnd, "UPDATE authors SET auth_name = ?cAuthorName WHERE 
auth_id = ?cAuthorID")
 
&& Close the connection
SQLDISCONNECT(nHnd)


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Przemyslaw 
Czerpak
Sent: Friday, October 24, 2008 9:57 PM
To: Harbour Project Main Developer List.
Subject: Re: RE: RE: [Harbour] Xbase++ go to visual fox pro

On Fri, 24 Oct 2008, Massimo Belgrano wrote:

Hi Massimo,
I'm sorry but I do not know what this code does.
I want to implement pure SQL support for Harbour. The controls
and visual elements has nothing to do with it.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to