Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot update the cursor
Message
From
08/10/2008 06:39:04
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01353585
Message ID:
01353595
Views:
17
>Hi Tore
>
>Yes, that's the construct I would use, but just:
>
>
>>REPLACE REFERENCE WITH ALIAS.REFERENCE in cPX_PRODUCTS
>>
>
>Now, are you clutching at straws for an answer (it's a long shot but it just might work) or are you saying that's the error? Because 1) I haven't been able to replicate the error, 2) it would mean a tortuous, source controlled update process to the customer, only to "suck it and see" and I couldn't predict if/when he'll get the errror again.

I don't know if this will fix your problem, but at least it's the "correct" way to do it. The added ..in yourtable.. will make sure that the updated will happen even if you are on the "phantom record" in the selceted work area. Another shot in the dark, could this user have little space left in his/her temp directory?

Regarding selecting form a cursor into a new cursor with the same name, that's safe and sometimes a real timesaver. I use this for instance for wildcard searches in a table, a la google, where my users types in different words in a textbox, and want all the records where all the words are in this table. My code is something like
lcTarget='curDummy'
For x=1 to getwordcount(lcLongText)
   if x=1
      lcTable='mybigtable'
   else
     lcTable=lcTarget
   endif
   lcText=upper(getwordnum(lcLongText,x))
   select from (lcTable) where lcText$upper(field1+'|'+field2+|+field3) into cursor (lcTarget) readwrite
Endfor
>Furthermore, I don't understand how the SQL can select a table into a cursor of the same name. When I try it I get an "Alias in in use" error.
>
>>Try
>>REPLACE cPX_PRODUCTS.REFERENCE WITH ALIAS.REFERENCE in cPX_PRODUCTS
>>
>>>Hi Guys
>>>
>>>A customer has a few times now got the system error handler message "ERROR: (111) Cannot update the cursor CPX_PRODUCTS, since it is read-only." on the following replace command:
>>>
>>>
>>>IF TYPE("cPX_PRODUCTS.Reference") = "C"
>>>	REPLACE cPX_PRODUCTS.REFERENCE WITH ALIAS.REFERENCE
>>>ENDIF
>>>
>>>
>>>Now this cursor is ALWAYS created ReadWrite, and, unfortunately, in several places, in several sets of circumstances and slightly differently, in the form code, typically
>>>
>>>
>>>SELECT cPX_PRODUCTS.*,;
>>>	IIF(!EMPTY(cPX_PRODUCTS.CatID),cPX_PRODUCTS.CatSellPrice,0000000000.0000) as SellPrice, ;
>>>	!EMPTY(cPX_PRODUCTS.CatID)as SellCalculated,;
>>>	IIF(EMPTY(cPX_PRODUCTS.CatID),ThisFOrmset.SellingPriceLstInclusive,cPX_PRODUCTS.CatInclusive) as SellInclusive ;
>>>	FROM cPX_PRODUCTS ;
>>>	INTO CURSOR cPX_PRODUCTS READWRITE
>>>
>>>
>>>and I can't be sure without exhaustive tracking which is used in these cases, as it's hard to predict exactly what the cust did just prior to this error.
>>>
>>>The cust has confirmed that there is plenty of disk space.
>>>
>>>Not my code, of course. I've rarely come across the replace construct:
>>>
>>>
>>>Replace TableName.FieldName with ...
>>>
>>>
>>>as used above (and frequently throughout the system).
>>>
>>>Note also that cPX_PRODUCTS is selected from to produce the cursor cPX_PRODUCTS
>>>
>>>Any ideas why this may happen?
>>>
>>>'ppreciate it
>>>
>>>Terry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform