Liviu Solcovenco
Liviu Solcovenco

Reputation: 85

Save queries in VFP

How to save queries on disk.I use the TO clause(example:SELECT * FROM vendors TO w.qpr).Everything works,but when I run the query with DO i receive the following error: http://s52.radikal.ru/i138/1201/2f/15765ffe2346.png And what should I change in order to obtain the query like in query designer,I mean that the query should appear in browse window,but using the command mode. Thank you in advance.

Upvotes: 1

Views: 2472

Answers (2)

user2799971
user2799971

Reputation: 1

As in the other answer, use MODIFY command to make a .prg for your select code.

The INTO clause is for the result.

SELECT * FROM zip INTO CURSOR c_zip

Or

SELECT * FROM zip INTO TABLE c:\temp\test 

If you want a XLS or CSV or something, select into a cursor then use

EXPORT TO c:\temp\zip.csv XL5

To save a query file Do File, New, and select QUERY radio button.

Upvotes: 0

Tamar E. Granor
Tamar E. Granor

Reputation: 3937

The TO clause is for storing the results of the query, not the query itself. (And, TO is a VFP extension; INTO is preferred.)

If you want to save the query, open up a PRG file (MODIFY COMMAND) and write the query there, then save it.

If you simply omit the TO or INTO clause, the query results will appear in a BROWSE window. Alternatively, use INTO CURSOR and give a cursor name, then issue BROWSE to browse the cursor.

Tamar

Upvotes: 5

Related Questions