Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select Into 'self' not possible after Use Again
Message
From
30/03/2000 01:53:54
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00343598
Message ID:
00352582
Views:
16
Mark,
I don't understand it either. If you don't want to solve it other way and just error message bothers you than "discard it" :

on error return && Or anything as do nothing like - on error dummy=1
select * from tmp into cursor tmp
on error

OTOH I don't suggest it at all. You'd be recreating copies of a table which could be noticably time consuming with large tables (provided your disk has space).
Cetin


>Hi Cetin,
>
>Here is a way to reproduce what I mean, I create a cursor and then I'd like to make it read/write by using it again. I do this twice because I want it to have the same name. I'm not looking for an other way to do this but I'd like to find out why I get an "alias is already in use" error when I have reused it and not otherwise. In the code below it works fine but I don't have the tmp Cursor Read/Write. When you uncomment the commented lines you'll have a read/write tmp Cursor but the error will occur then.
>
>select * from table into cursor tmp nofilter
>use dbf('tmp') again in 0 alias tmp2
>* use in tmp
>* select tmp2
>* use dbf('tmp2') again in 0 alias tmp
>* use in tmp2
>select * from tmp into cursor tmp
>
>
>>>>
Mark,
>>>>Other than some cleanup benefits cursors are "always" written to disk. IMHO take the easy way and select into table.
>>>>OTOH if you have a DBC open (or create a temp one) you could create-drop a temp view on the fly.
>>>>Cetin
>>>
>>>Cetin,
>>>I'm actually not looking for the 'easy way'; I want to know what happens and why it doesn't work.
>>
>>
W/o seeing some code my best guess is that you're not selecting into a true cursor. You could make a true cursor :
>>-Including a dummy nonexistant field in SQL
>>select *, 1 as myDummy ...
>>-Including a dummy .t. expression in where
>>select * rom myTable where .t. [ and ...] ...
>>Above are also FP2x compliant. In VFP you could also :
>>-Use "nofilter" clause
>>select ... nofilter
>>
>>A sample readwrite cursor :
>>
select * from myTable into cursor crsTemp nofilter
>>use (dbf("crsTemp")) in 0 again alias "myRW"
>>use in ("crsTemp")
>>select myRW
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform