Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdaptor / XMLAdaptor
Message
From
06/08/2003 03:54:20
 
 
To
06/08/2003 00:32:06
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00816919
Message ID:
00817190
Views:
29
>Hi Aleksey,
>
>The code below is very similar to your code. The "catest" class is a CursorAdapter class which works fine when configured as an SQL Server ODBC connection to the Northwind database. However, if configured as an ADO connection, the error "Ole object is invalid or corrupt" is thrown at loXA.Tables(1).ApplyDiffGram("", loCA) shown below. I should have been more specific in my original message.
>
>
>LOCAL loCA AS CursorAdapter, loXA AS XMLAdapter, lcXML AS String
>
>loCA = NEWOBJECT("catest", "c:\program files\microsoft visual foxpro 8\testit.vcx")
>loCA.CursorFill()
>loXA = CREATEOBJECT("XMLAdapter")
>loXA.AddTableSchema("cursor1")
>loXA.ToXML("lcXML")
>RELEASE loCA
>RELEASE loXA
>
>loXA = CREATEOBJECT("XMLAdapter")
>loXA.LoadXML(lcXML)
>loXA.Tables(1).Alias = "cursor1"
>loXA.Tables(1).ToCursor()
>
>SELECT cursor1
>CURSORSETPROP("Buffering", 5)
>REPLACE contactname WITH ALLTRIM(contactname) + " - Howdy!"
>
>loXA.ReleaseXML(.F.)
>loXA.IsDiffgram = .T.
>loXA.toXML("lcXML","",.F.,.T.,.T.)
>RELEASE loXA
>USE IN cursor1
>
>loXA = CREATEOBJECT("XMLAdapter")
>loXA.LoadXML(lcXML)
>loCA = NEWOBJECT("catest", "c:\program files\microsoft visual foxpro 8\testit.vcx")
>loXA.Tables(1).ApplyDiffGram("", loCA)
>
>RELEASE loXA
>RELEASE loCA
>
>


Hi Jeff,

You are still not specific. :-) I have no idea how the CA subclass is configured. Could you translate .VCX class definition into .PRG class definition and post it here?

Looks like something is wrong with loXA.*DataSource property.

To apply changes, ApplyDiffgram method attaches a new cursor to loCA and then calls TABLEUPDATE(.T.) internally. I guess loCA is configured to send updates via ADODB.Recordset object. This isn't going to work because the new cursor is not associated with any ADODB.Recordset object. You should try to configure loCA object to send updates via ADODB.Command object.

BTW, at the time when ApplyDiffgram is called, the loCA still has the original cursor attached. That cursor is closed by CursorAdapter when the new cursor is attached. Usually, when CursorAdapter closes ADO based cursor, it also closes ADODB.Recordset associated with the cursor. Usually means - the ADODB.Recordset is closed if the cursor was created by CursorFill method, it was never detached from CursorAdapter object and it wasn't reopened AGAIN in another work area.

Thanks,
Aleksey.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform