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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close all open cursors

Status
Not open for further replies.

INFORMAT

Programmer
Jan 3, 2001
121
BE
Hi,

I am using SPT cursors instead of the dataenvironment. So I don't use any remote views. My data is stored in a back-end SQL Server 2000 database.

So I don't use the Data Environment anymore.

I have a question:

How can I close all the open cursors after the user closed the forms?
 
Informat,

If the form has a private data session, you don't need to do anything. The cursors will close automatically when the form closes.

Othewise, you can loop through the cursor, like so:

lnWorkAreas = SELECT(1) - 1
FOR lnI = 1 to lnWorkAreas
USE IN (lnI)
ENDFOR

Bear in mind that this will close all cursors and tables, not just SPT ones.

Mike



Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
If the form creates all these cursors, and you create the form so that it uses a Private Datasession (DataSession = 2 - Private), then they will all be closed automatically for you.

Rick
 
Code:
CREATE TABLE tempTbl (f2 c(1))

CREATE CURSOR tempCur (f2 c(1))

FOR lnUsed = 1 TO AUSED(laWorkSpaces)
SELECT laWorkSpaces(lnUsed,1)
  IF JUSTEXT(DBF())="TMP"
    WAIT WINDOW TIMEOUT 3 [Closing Cursor: ]+JUSTSTEM(DBF())
    USE
  
  ELSE
      WAIT WINDOW TIMEOUT 3 [Not Closing Table: ]+JUSTSTEM(DBF())
  ENDIF
ENDFOR

Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top