Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFPCom.ComUtil Problems
Message
From
19/01/2003 23:22:33
David Mckay
Australian Workplace Software
Sydney, Australia
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
VFPCom.ComUtil Problems
Miscellaneous
Thread ID:
00743362
Message ID:
00743362
Views:
68
1. I am having some trouble with the VFPCom.CursorToRS() function. The problem is that it creates the recordset with the wrong field attributes eg memo ado constant is 201 but it makes it 129 and sets the defined length to 256 so then the data gets truncated.

2. The next problem is that when you have multiple memo fields but you only fill in one memo field of the cursor, when running the cursortors() it replicates the data from the memo field filled in to the other memo fields even though they are blank. We're using VFP7 with the COMUtils we also set the null values on all memo fields. We came across these problem when setting the recordset data for the crystal reports.

-HERE SOME SAMPLE CODE ON WHAT WE ARE DOING-

LOCAL loVFPCom AS VFPCOM.ComUtil
LOCAL loRecordSet AS ADODB.Recordset
*-- creating the cursor
CREATE CURSOR test (memo1 m NULL, memo2 m NULL, memo3 m NULL)
SELECT test
*-- adding in 2 records
INSERT INTO test (memo1, memo2, memo3) VALUES (REPLICATE('testing',100), NULL, NULL)
INSERT INTO test (memo1, memo2, memo3) VALUES (REPLICATE('testing',100), "test1", "test2")

loVFPCom = CREATEOBJECT("VFPCOM.ComUtil")
loRecordSet = CREATEOBJECT("ADODB.Recordset")
*-- Creating the recordset using vfpcom.util
loVFPCom.CursorToRS(loRecordSet)

loRecordSet.MoveFirst()
*-- messagebox the type ado constant how big the field is and it value
MESSAGEBOX(loRecordSet.FIELDS("memo1").TYPE)
MESSAGEBOX(loRecordSet.FIELDS("memo1").DefinedSize)
MESSAGEBOX(loRecordset.Fields("memo1").Value)
MESSAGEBOX(loRecordset.Fields("memo2").Value)
MESSAGEBOX(loRecordset.Fields("memo3").Value)

loRecordSet.MoveNext()
MESSAGEBOX(loRecordSet.FIELDS("memo1").TYPE)
MESSAGEBOX(loRecordSet.FIELDS("memo1").DefinedSize)
MESSAGEBOX(loRecordset.Fields("memo1").Value)
MESSAGEBOX(loRecordset.Fields("memo2").Value)
MESSAGEBOX(loRecordset.Fields("memo3").Value)
Next
Reply
Map
View

Click here to load this message in the networking platform