FIX: Error Updating Table with Empty Date Using VFP OLEDB Provider (314650)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 7.0

This article was previously published under Q314650

SYMPTOMS

When you use the Visual FoxPro (VFP) 7.0 OLEDB provider to create an ActiveX Data Objects (ADO) recordset on a Visual FoxPro table that has a date-type field, the following error may occur when you use the ADO UPDATE() method to update the values in a record that contains an empty date-type field:
Multiple-step operation generated errors. Check each status value.
This error occurs even if you do not attempt to modify the value of the date-type field in the record.

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.

MORE INFORMATION

Steps to Reproduce Behavior

To reproduce the problem, paste the following code in a new program (.prg) file and run it:
ON ERROR DO ERR_HAND

CLEAR
CD JUSTPATH(SYS(16))
LOCAL loCONN AS ADODB.Connection, ;
	loRS AS ADODB.Recordset, ;
	lcConnStr as String

ERASE MyDBF.*
CREATE TABLE MyDBF (sys_cust N(8), cust_no c(6), ddate d)
INSERT INTO MyDBF VALUES (12345678,"CUST12",{})
USE IN MyDBF

lcConnStr = [Provider=VFPOLEDB.1;Data Source=] + JUSTPATH(SYS(16,0))
loCONN = CREATEOBJECT("ADODB.Connection")
loRS = CREATEOBJECT("ADODB.Recordset")

loCONN.Mode = 12
loCONN.CursorLocation = 3
loCONN.OPEN(lcConnStr)

WITH loRS
	.OPEN("select * from MyDBF", loCONN, 1, 3)
	.FIELDS(0) = 543543
	.FIELDS(1) = "222001"
	.FIELDS(2)= DATE()
	.UPDATE()
	.CLOSE
ENDWITH
	
loRS = NULL
loCONN.CLOSE
loCONN = NULL

RELEASE ALL
WAIT WINDOW "Update successful..." NOWAIT NOCLEAR 
USE MYDbf
BROWSE
USE IN SELECT("MYDBF")
WAIT CLEAR


*~~~~~~~~~~~~~~
PROCEDURE ERR_HAND
	ON ERROR
	AERROR(aTest)
	_CLIPTEXT = aTest(3)
	DISPLAY MEMORY LIKE aTEST
	RELEASE ALL
	CLOSE DATABASES ALL
	CLEAR ALL
	CANCEL
				
When you run this code using the VFP 7.0 version of the VFP OLEDB Provider, the error mentioned in the "Symptoms" section occurs. When you use the VFP 7.0 SP1 version of the VFP OLEDB Provider, no error occurs and the UPDATE() call is successful.

Modification Type:MajorLast Reviewed:2/18/2002
Keywords:kbbug kbCodeSnippet kbDSupport KB314650