Microsoft KB Archive/141557

= FIX: Cursor's ReadOnly Property Carried to Other Data Sessions =

Article ID: 141557

Article Last Modified on 9/30/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition

-



This article was previously published under Q141557



SYMPTOMS
When you use the same table in separate forms that have Private Data Sessions, the ReadOnly property of a cursor is carried over from the first session.



STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual FoxPro 5.0 for Windows.



MORE INFORMATION
The following steps demonstrate the behavior. The behavior is specific to the order in which you launch these forms. If you launch the ReadWrite form first, issuing the APPEND BLANK command does in fact append a blank record to the table and the record is visible in the grid on the ReadOnly form. On the other hand, if you launch the ReadOnly form first, issuing the APPEND BLANK command causes an error. Both these behaviors show that the Data Session is not truly private.

Steps to Reproduce Problem
 Create a form and call it ReadWrite. Right-click the form, and select Data Environment. Then right-click the Data Environment window, and select Add. Select a table and add it to the Data Environment. Then select the table in the Data Environment, and change its ReadOnly property to false (.F.) in the Property Sheet. Select the form and change its DataSession property to 2 - Private Data Session.  Place a command button on the form, and change its Caption property to Append. Then add the following code to its Valid event: APPEND BLANK  Create a second form, and name it ReadOnly. Right-click the new form, and select Data Environment. Then right-click the Data Environment window and select Add. Select the same table selected in step 2 and add it to the Data Environment. Select the table in the Data Environment and change its ReadOnly property to true (.T.) in the Property Sheet. Select the form and change its DataSession property to 2 - Private Data Session. Drag the table from the Data Environment to the ReadWrite form to create s grid.</li> Run the ReadWrite form. Then run the ReadOnly form. Click the Append button in the ReadWrite form. Then click the first blank record in the grid on the ReadOnly form. Note that although you can click into the new record and see the caret blinking there, you cannot enter data into the blank record.</li> Close both forms. With the USE command, open the table and delete the added record. Then pack the table.</li>  Run the ReadOnly form. Then run the ReadWrite form. Note that you reversed the order in which the forms were launched. Click the Append button in the ReadWrite form. Note that the Trace window appears with the Valid code of the command button exposed highlighting the line of code that states: APPEND BLANK Also, an error occurs that states:

Cannot update cursor.

After you click Ignore, note that the grid does not have a blank record. </li></ol>

Keywords: kbbug kbfix kbvfp500fix KB141557

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.