Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor is read-only
Message
From
08/02/2012 02:00:59
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01534815
Message ID:
01534825
Views:
63
This message has been marked as a message which has helped to the initial question of the thread.
>>>Hi everybody,
>>>
>>>I have the following code
>>>
>>>
>>>select I.id, I.Department, I.Category, I.item, I.descrip, ;
>>>	inlist(proper(I.MatrixItem),'Yes','1','True','T') as i_matrix,  ;
>>>	upper(MatrixTemplate) as MTemplate, GLNumber as gl_no, UserDefined as user_code, ;
>>>	Barcode, UPC, inlist(DirectPricing,'Yes','1','True','T') as set_price, ;
>>>	iif(len(PriceType)=0 or PriceType ='0',1,4) as price_cols, ;
>>>	Price as monday_0, dp_set_id, cast(PriceCalculationType as I) as daily_pric, AddTax as add_tax, ;
>>>	Tax_Rate, Tax_Rate_B, upper(Vendor1) as Vendor1, upper(Vendor2) as Vendor2, ;
>>>	VendorPartNumber as vpartno, ReorderPoint as reorder_pt, TargetQty as target_qty, ;
>>>	pr_ctr_1, 1 as split_type, 100 as pcsplit_1, ;
>>>	UserDefinedText1 as i_text_1, UserDefinedText2 as i_text_2, I.subclass, I.Season   ;
>>>	from csrItems I where id not in (select id from csrDups) into cursor csrItems READWRITE
>>>
>>>
>>>The csrItems originally is created with the long field names using CREATE CURSOR command. Now I'm selecting fields from into a readwrite cursor.
>>>
>>>However, when I try to replace a field in this cursor with the value, I get 'cursor is read-only' message. What may be a reason for such behavior?
>>>
>>>Thanks in advance.
>>
>>I don't understand the last line at all. You're selecting from and into csrItems in one command?
>
>Yes, it is permitted and it works, but I suspect it may not allow to select into itself and keep it readwrite. Help doesn't mention anything about it, but I guess I will need to change it to csrItems1. I may need to then re-examine all code to fix the references. I'll plan to do it tomorrow - now it's quite late.

It should work.

try to move the into before the FROM clause
CREATE CURSOR X ( A I)
APPEND blank
REPLACE A WITH 1 IN X

SELECT 2 AS B,*;
	INTO CURSOR X READWRITE	FROM X
WAIT WINDOWS ISREADONLY('X')
REPLACE B WITH 3 IN X
BROWSE

* remember that if the select execution fails, you lose the original alias
* next doesn't work
SELECT X.B INTO CURSOR X READWRITE	FROM X Y

* and the datasession is empty now
WAIT windows AUSED(Q)
Previous
Reply
Map
View

Click here to load this message in the networking platform