Article ID: 263914
Article Last Modified on 7/27/2001
APPLIES TO
- Microsoft Visual FoxPro 5.0 Standard Edition
- Microsoft Visual FoxPro 5.0a
- Microsoft Visual FoxPro 6.0 Professional Edition
This article was previously published under Q263914
SYMPTOMS
After performing a CREATEOFFLINE() function on a remote view, the resulting table (.dbf) file record count is zero (0) while its file size indicates that it should contain data.
RESOLUTION
As a workaround, use the file size to calculate the number of expected records and modify the table header through low-level file input/output (I/O) to reflect that number. For additional information on this workaround, see the "References" section later in this article.
MORE INFORMATION
This problem occurs when the data that is pulled by the remote view is in excess of 50 Megabytes in size and the offline view is created on a less capable computer than is needed.
NOTE: This problem may not be immediately reproducible.
Environment Specifics for Reproduction
- Pentium processor, 120 MHz clock speed
- 64 Megabytes of RAM
Steps to Reproduce Behavior
- Create a new folder to contain this reproduction. For this example, call it C:\OFFLINE.
Open the customer.dbf file that ships with Visual FoxPro, and copy it to the reproduction folder as follows:
COPY TO c:\offline\customer
Place the following code into a program in your reproduction folder called c:\offline\testprog.prg:
*!* Beginning of TESTPROG.PRG USE CUSTOMER EXCLUSIVE ALTER TABLE customer ADD COLUMN field1 c(10) NULL ; ADD COLUMN field2 c(10) NULL ; ADD COLUMN field3 c(10) NULL lcRepString = "XXXXXXXXXX" REPLACE ALL field1 WITH lcRepString, ; field2 WITH lcRepString, ; field3 WITH lcRepString SET SAFETY OFF COPY TO tempcust FOR iCopy = 1 TO 2288 APPEND FROM tempcust ENDFOR SET SAFETY ON ERASE tempcust.dbf *!* Based on an initial record count of 92, the *!* resulting table will contain 210,588 records *!* and the file size will be 65,072,501 bytes.
Set your Visual FoxPro default folder to your reproduction folder as follows:
CD c:\offline
Run the testprog.prg as follows:
DO testprog
Once the preceding test program (or similar) is established, perform the following:
Place the following code into a program in your reproduction folder called c:\offline\testconn.prg:
*!*Beginning of TESTCONN.PRG CLEAR ALL CLOSE ALL RELEASE ALL CLOSE DATA ALL CREATE DATABASE testoffline CREATE CONNECTION connect1 CONNSTRING ; 'DRIVER={Microsoft Visual FoxPro Driver};' + ; 'Exclusive=Yes;SourceType=DBF;SourceDB='c:\offline\' CREATE SQL VIEW remote_customer ; AS SELECT * ; FROM customer =CREATEOFFLINE('remote_customer') CLOSE DATA ALL DIR remote_customer.dbf
Run the testconn.prg by using the following code:
DO testconn
- If this process reproduces the problem, note that a file size of 65,072,501 bytes and 0 records appears.
REFERENCES
For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
263902 Table/dbf File Record Count Incorrect Based on File Size
Keywords: kbsqlprog kbcodesnippet kbdatabase kbprb kbclientserver KB263914