Microsoft KB Archive/314735

= FIX: Garbled Field Name Is Returned with VFP OLEDB Provider on Windows 95 =

Article ID: 314735

Article Last Modified on 5/17/2007

-

APPLIES TO


 * Microsoft Visual FoxPro 7.0 Professional Edition, when used with:
 * Microsoft Windows 95

-



This article was previously published under Q314735



SYMPTOMS
On a computer that is running Windows 95, you use the Visual FoxPro (VFP) OLEDB Provider to create an ActiveX Data Objects (ADO) recordset based on a VFP table. When you reference one of the fields in the table, one of two problems may occur:  If you reference the field name by the fields collection index number (for instance, &quot;RS.Fields(0).Name&quot;), garbled output appears. If you reference the field name directly by specifying the field name (for instance, &quot;Fields(&quot;f1&quot;).Name&quot;), the following errors may occur:

Microsoft Visual Basic error message

Item can not be found in the collection corresponding to the requested name or ordinal.

Visual FoxPro error message

Member FIELDS does not evaluate to an object.





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 the VFP OLEDB Provider installed with Visual FoxPro 7.0. This problem was first corrected in Visual FoxPro for Windows 7.0 Service Pack 1.



Steps to Reproduce Behavior
  Use Visual FoxPro 7.0 to build the following code into a new executable (.EXE) file:
 * 1) DEFINE adUseClient            3
 * 2) DEFINE adOpenStatic           3
 * 3) DEFINE adLockBatchOptimistic  4

CD JUSTPATH(SYS(16)) ERASE TestDBF.* CREATE TABLE TestDBF (F1 c(5)) INSERT INTO TestDBF VALUES (&quot;HELLO&quot;) USE IN SELECT(&quot;TestDBF&quot;)

LOCAL loRS AS ADODB.RecordSet, ; loConn AS ADODB.CONNECTION

loConn = CREATEOBJECT(&quot;ADODB.Connection&quot;) loRS = CREATEOBJECT(&quot;ADODB.RecordSet&quot;)

loConn.CursorLocation = adUseClient loConn.OPEN(&quot;Provider=vfpoledb;Data Source=&quot; + JUSTPATH(SYS(16)))

loRS.OPEN(&quot;SELECT * FROM TestDBF&quot;, loConn, adOpenStatic, adLockBatchOptimistic) WITH loRS MESSAGEBOX(&quot;Fieldname should be f1. It is &quot; + .FIELDS(0).NAME) MESSAGEBOX(&quot;Fieldname should be f1. It is &quot; + .FIELDS(&quot;F1&quot;).NAME) ENDWITH

loRS.CLOSE loConn.CLOSE

RELEASE ALL NOTE: This sample code requires ADO, which does not ship with Windows 95 but is included with the Microsoft Data Access Components (MDAC) package. You can obtain the latest version of MDAC from the following Web site:

http://msdn2.microsoft.com/en-us/data/aa937695.aspx

 Install the executable and the pre-SP1 release version of the Visual FoxPro OLEDB Provider on a Windows 95 computer. Run the EXE to see the error messages.</li></ol>

Additional query words: kbVFP700sp1fix

Keywords: kbbug kbclientserver kbcodesnippet kbdatabase kbfix KB314735

-

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

© Microsoft Corporation. All rights reserved.