Using Resync with ADO and complex SQL Query statement using left outer joins



Hello
I have a problem when I try to resync a recordset generated from a complex
sql query, I get this error:

Run-time error '-2147217885 (80040e23)'
Key value for this row was changed or deleted at the data store. The local
row is now deleted.

I found this issue only when I try to resync a row which has a joined on a
null row from the other table.

Here is my source code:
'*************************************
Set objConn = CreateObject("ADODB.Connection")
Set objCmd = CreateObject("ADODB.Command")
Set objRS = CreateObject("ADODB.Recordset")

objconn.Provider="sqloledb"
objconn.Open "Data Source=myserver; Initial Catalog=test", "sa", "sa"

Set objCmd.ActiveConnection = objConn

objCmd.CommandText = "SELECT DOCUMEN.*, CATEG.dexcat FROM DOCUMEN LEFT JOIN
ANAGRAF ON DOCUMEN.codana=ANAGRAF.codana LEFT JOIN CATEG ON
ANAGRAF.codcat=CATEG.codcat WHERE DOCUMEN.codana = '00001'"

objrs.cursorType = 1 ' adOpenKeyset
objrs.cursorLocation = 3 ' adUseClient
objrs.lockType = 3 ' adLockOptimistic
objRS.Open objCmd ' here the recorset has the right records

objRS.resync(1) ' adAffectCurrent -> error!!

'*************************************

the error is thrown only if the field ANAGRAF.codcat is NULL
any hint?
Thanks
Simone


.



Relevant Pages