General information
Category:
Visual FoxPro Beta
Title:
Possible BUG with CA and delete operations
In our project, we use cursoradapters to connect to a SQL Server via ADO. We recompiled the whole thing in vfp 9 beta, and most of it seems to work perfectly - great job by the fox team!
However, there are some problems when deleting from a CA based on joined tables. The sample code below runs perfectly fine in fox 8, but in 9b, TableUpdate returns .F., and the error message is "Microsoft Cursor Engine : Row handle referred to a deleted row or a row marked for deletion".
code:
Public loCAdapter As CursorAdapter
Local loCon As ADODB.Connection
loCon = Createobject("ADODB.Connection")
loCon.Open("")
loCAdapter = Createobject("catest")
loCAdapter.DataSourceType="ADO"
loCAdapter.Datasource = Createobject('ADODB.RecordSet')
loCAdapter.Datasource.CursorLocation = 3 && adUseClient
loCAdapter.Datasource.LockType = 3 && adLockOptimistic
loCAdapter.BufferModeOverride = 5
loCAdapter.Datasource.ActiveConnection = loCon
loCAdapter.BreakOnError= .T.
loCadapter.Alias = "caTest"
llReturn = loCAdapter.RetrieveData()
If !llReturn
MessageBox(Message())
EndIf
Select caTest
delete all
if !tableupdate(.T.)
Messagebox(message())
endif
Define Class caTest As cursoradapter
Procedure selectcmd_assign
Lparameters vNewVal
This.SelectCmd = Chrtran(m.vNewVal, Chr(13) + Chr(10), "")
EndProc
Procedure retrievedata()
Text To this.selectcmd Noshow textmerge
Select testchild.id, testchild.foreignkey, testchild.somedata,
testparent.descr
from testchild, testparent
where testparent.id = testchild.foreignkey
EndText
this.UpdatableFieldList = "id, foreignkey, somedata"
this.UpdateNameList = "id testchild.id, foreignkey testchild.foreignkey, somedata testchild.somedata"
this.Tables = "Testchild"
this.KeyFieldList = "id"
Return this.CursorFill()
EndProc
Procedure aftercursorfill
Lparameters lUseCursorSchema, lnoDataOnLoad, cSelectCmd, lResult
This.DataSource.Properties("Unique Table") = this.Tables
EndProc
Enddefine
Any help would be greatly appreciated.
Thanks,
Eyvind.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only