Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor deleted lines
Message
From
16/04/2007 12:24:12
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01216294
Message ID:
01216311
Views:
18
Hi
maybe something not clear for me.
I got 4 in both command boxes in your two ways solution (I got a error message in both, maybe I corrected it wrong.
can you check it please and resend again?
>>Hi
>>How can I run 'set deleted on' on cursor, take a look on the following code:
set deleted on
>>create cursor cursr1 (myfield c(3))
>>insert into cursr1 values ('AAA')
>>insert into cursr1 values ('BBB')
>>insert into cursr1 values ('CCC')
>>insert into cursr1 values ('DDD')
>>
>>select cursr1
>>index on myfield tag myfield
>>set order to tag myfield in cursr1
>>
>>crtotallines1=alltrim(str(reccount('cursr1')))
>>
>>messagebox(crtotallines1)
>>
>>
>>select cursr1
>>if seek ('CCC','cursr1','myfield')=.f.
>>messagebox('prob',0+16)
>>return
>>endif
>>delete in cursr1 for cursr1.myfield='CCC'
>>
>>select cursr1
>>crtotallines2=alltrim(str(reccount('cursr1')))
>>
>>messagebox(crtotallines2)
>>
>>How can I get '3' in the second messagebox?
>>
>>Thank's
>
>One way:
>
>set deleted on
>create cursor cursr1 (myfield c(3))
>insert into cursr1 values ('AAA')
>insert into cursr1 values ('BBB')
>insert into cursr1 values ('CCC')
>insert into cursr1 values ('DDD')
>
>select cursr1
>index on myfield tag myfield
>set order to tag myfield in cursr1
>
>crtotallines1=alltrim(str(reccount('cursr1')))
>
>messagebox(crtotallines1)
>
>
>select cursr1
>if NOT seek ('CCC','cursr1','myfield')
>   messagebox('prob',0+16)
>   return
>endif
>delete in cursr1 for cursr1.myfield='CCC'
>SET DELETED OFF
>select cursr1
>seek ('CCC','cursr1','myfield')
>crtotallines2=alltrim(str(reccount('cursr1')))
>messagebox(crtotallines2)
>SET DELETED ON
>
>
>Other way:
>
>set deleted on
>create cursor cursr1 (myfield c(3))
>insert into cursr1 values ('AAA')
>insert into cursr1 values ('BBB')
>insert into cursr1 values ('CCC')
>insert into cursr1 values ('DDD')
>
>select cursr1
>index on myfield tag myfield
>set order to tag myfield in cursr1
>
>crtotallines1=alltrim(str(reccount('cursr1')))
>
>messagebox(crtotallines1)
>
>
>select cursr1
>if NOT seek ('CCC','cursr1','myfield')
>   messagebox('prob',0+16)
>   return
>endif
>lnRecNo = RECNO([Curs1])
>delete in cursr1 for cursr1.myfield='CCC'
>
>select cursr1
>GOTO lnRecNo
>crtotallines2=alltrim(str(reccount('cursr1')))
>messagebox(crtotallines2)
>
>
Thank you
Chaim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform