Microsoft KB Archive/317980

= FIX: When you use table buffering and insert records, Visual FoxPro may stop responding =

Article ID: 317980

Article Last Modified on 4/15/2005

-

APPLIES TO


 * Microsoft Visual FoxPro 7.0 Professional Edition

-



This article was previously published under Q317980



SYMPTOMS
If you use optimistic table buffering, and you insert a large number of records that use transactions into the table, Visual FoxPro may stop responding.



RESOLUTION
To resolve this problem, obtain the latest service pack for Visual FoxPro for Windows 7.0. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

316964 How to Obtain the Latest Visual FoxPro for Windows 7.0 Service Pack



STATUS
Microsoft has confirmed that this is a problem in Microsoft Visual FoxPro for Windows 7.0.

This problem was first corrected in Visual FoxPro for Windows 7.0 Service Pack 1.



Steps To Reproduce Behavior
  Paste the following code in a program (.prg) file, and then run the program from the Command window:
 * 1) DEFINE NUMRECORDS 600

LOCAL i, n,nRecNo

CLEAR ALL CLEAR SET TALK OFF SET SAFETY OFF SYS(3050,1,100) SYS(3050,2,100)

CLOSE DATABASES ALL CREATE DATABASE Test
 * Close any open databases.

ERASE Test.dbf CREATE TABLE Testx (name c(100),aa c(100)) CREATE SQL VIEW Test AS SELECT * FROM Testx USE Test REQUERY SET MULTILOCKS ON INDEX ON name TAG name CURSORSETPROP(&quot;buffering&quot;,5)

FOR i = 1 TO NUMRECORDS INSERT INTO Test (name) VALUES (TRANSFORM(i)) ENDFOR
 * Add 600 records to the table.

RAND(1)
 * Generate a random number between 0 and 1.

FOR i = 1 to RECCOUNT n=INT(RAND*RECCOUNT+1) GOTO n  REPLACE name WITH TRANSFORM(RECCOUNT-i)

* Display the records at 100, 200, and so on. IF MOD(i,100) = 0 ? i  ENDIF ENDFOR

BEGIN TRANSACTION INSERT INTO Test (name) VALUES (&quot;test&quot;) END TRANSACTION
 * Insert another record in the table.

LOCATE nRecNo = 0 SCAN * Display the record number and the contents of the name field. * The record number is negative because the record has been appended in   * a buffer. FoxPro will lock up on record number 573. It happens when it   * is scanning through records after they have been inserted. ? RECNO, ALLTRIM(name) nRecNo = nRecNo + 1 ENDSCAN ? nRecNo, NUMRECORDS Note that Visual FoxPro stops responding while the program is running.
 * Locate the first logical record in the table.
 * Run through all of the records in the table.
 * Display final stats

 Press CTRL+ALT+DELETE to open Windows Task Manager, and then click End Task to close Visual FoxPro.

Keywords: kbbug kbfix kbvfp700sp1fix kbcodesnippet kbdatabase KB317980

-

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

© Microsoft Corporation. All rights reserved.