Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Phisit Thaeochanthuek
  Where is Phisit Thaeochanthuek?
 Ubon
 Thailand
 Phisit Thaeochanthuek
 To: Eric den Doop
  Where is Eric den Doop?
 Houten
 Netherlands
 Eric den Doop
 Tags
Subject: RE: beware of sql cursor read/write trick
Thread ID: 5535 Message ID: 228852 # Views: 2 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Friday, May 22, 2009 5:41:07 AM         
   


Hi Eric

> sele * from testtable into cursor testcursor

I'm not good in English but I want to share my idea
in your thread.

In my opinion when you select into cursor VFP will make
a new temp file with the new name (we can use Dbf() function to see the
temp file name)

when we use again and edit the record
it affect only the temp file (something like C:\FZFC00CD.TMP)
not the base table that we query from.

(if we use View with some parameter we can update the testtable)

i have modified your code like this below.

Create Table testtable (fielda C(2))
For i = 1 To 10
Appe Blan
Repl fielda With Transf(i)
Endfor
Sele * From testtable Into Cursor testcursor
Sele testcursor
?Alias() && as expected
?Dbf() && as expected because VFP sets a filter on this simple query
lcFile = Dbf()
IF USED('cursorrw')
USE IN cursorrw
ENDIF
Use (lcFile) Again Alias cursorrw In 0
Sele cursorrw
Repl All fielda With "AA"
? 'contents of cursorrw'
Scan
? fielda
ENDSCAN
? 'contents of testtable'
Sele testtable
Scan
? fielda
Endscan

************************************************
* the temp file (lcFile) is alway updated
************************************************

Use (lcFile) Again Alias cursorrw2 In 0
? 'contents of cursorrw2 ( query from temp file)'
Sele cursorrw2
Scan
? fielda
Endscan

ENTIRE THREAD

beware of sql cursor read/write trick Posted by Eric den Doop @ 11/30/2001 8:46:00 PM
RE: beware of sql cursor read/write trick Posted by drCipher @ 11/30/2001 9:31:20 PM
RE: beware of sql cursor read/write trick Posted by Eric den Doop @ 11/30/2001 9:46:32 PM
RE: beware of sql cursor read/write trick Posted by Phisit Thaeochanthuek @ 5/22/2009 5:41:07 AM
RE: beware of sql cursor read/write trick Posted by Andy Kramek @ 5/22/2009 12:20:59 PM
RE: beware of sql cursor read/write trick Posted by Eric den Doop @ 5/22/2009 12:31:00 PM
RE: beware of sql cursor read/write trick Posted by tushar @ 5/22/2009 12:35:01 PM
RE: beware of sql cursor read/write trick Posted by Ammar Hadi @ 5/22/2009 4:41:25 PM
RE: beware of sql cursor read/write trick Posted by tushar @ 5/22/2009 6:29:46 PM