Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing cursor created by SQLPREPARE

Status
Not open for further replies.

steinkebunch

Programmer
May 24, 2000
7
0
0
US
I'm using VFP6 to retrieve remote data from some Oracle tables. I can successfully retrieve the data into MyCursor using the command

Code:
SQLPREPARE(nConnectionHandle, cSQLCommand, "MyCursor")
Code:

However, when I try to use further code to manipulate MyCursor, such as

Code:
Use DBF("MyCursor")
Code:
or
Code:
Use ("MyCursor")
Code:

I get errors "File is in use." and "File Mycursor.dbf is not found" respectively. I guess since MyCursor is opened exclusively, the first error makes sense. I'm obviously missing something on how I am allowed to use a cursor created from a remote table. How can I use the cursor so that I can manipulate it (delete records, etc). Thanks in advance.

 
Instead of saying USE("MyCursor"), try SELECT("MyCursor")

-Steve
 
In the place of "USE" change it to "SELECT"
SELECT (MyCursor)
ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Hello.

The cursor is a temporary file on your hdd. It has a temporary name (something like 2ndf000a.tmp).

If you want to gain access to the cursor (for example, to obtain a writable copy of it), you have to use the following sintax:

USE DBF("mycursor") AGAIN in 0 ALIAS MySecondCursor

MySecondCursor is a writable copy. Anyway, the sintax you need is USE DBF("mycursor").

Hope this helps.

Grigore Dolghin
Class Software
Bucharest, Romania
 
Just for clarification, SQLPREPARE() is not used to retrieve result sets. It simply passes the SQL command to the backend database for compilation. You must still issue SQLEXEC() to execute the SQL command(s).

SQLPREPARE(nConnectionHandle, cSQLCommand, "MyCursor")
SQLEXEC(nConnectionHandle)
WAIT WINDOW TRANS(RECCOUNT('MyCursor'))+' Records Returned.'

SET DELETED OFF
COUNT FOR DELETED() TO lnDeleted
WAIT WINDOW TRANS(lnDeleted)+' Records Marked for Deletion.'

DELETE ALL
COUNT FOR DELETED() TO lnDeleted
WAIT WINDOW TRANS(lnDeleted)+' Records Marked for Deletion.' Jon Hawkins

The World Is Headed For Mutiny,
When All We Want Is Unity. - Creed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top