Using Resync with ADO and complex SQL Query statement using left outer joins
- From: "Simone Degl'Innocenti" <xxx@xxxxxx>
- Date: Thu, 12 Jan 2006 16:02:45 +0100
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
.
- Prev by Date: Re: MySQL ADO
- Next by Date: Re: Opening Stored Procedure...copying to local table...any faster way to do this?
- Previous by thread: RE: HOW TO: Implement transaction in TableAdapter class
- Next by thread: Re: Command object stops prematurely w/o failure
- Index(es):
Relevant Pages
- Re: Resync or Requiry
... The recordset returns a SINGLE row only ... Resync - The original SELECT
has been taken apart and a SELECT is being ... returns a single row, a requery is better
than a Resync. ... Requery method updates the data in a Recordset ... (microsoft.public.data.ado) - Union queries and batchoptimistic lock
... Whenewer I edit a record I use another dataset object ... query is refreshed).
... results because the resync method is called during the Post operation. ... Is
there a way to append one recordset to another (and via this way ... (borland.public.delphi.database.ado) - RE: Resync or Requiry
... difference between Resync and Requery method. ... Requery method updates
the data in a Recordset ... mehod refreshes the data in the current Recordset object,
... (microsoft.public.data.ado) - [Update Resync] Wont Stop Resyncing!
... VB6 app; Recordsets updated using UpdateBatch. ... our app used the default
"Update Resync" value ... to get back newly generated identity field ...
Does anyone know why we can't STOP our recordset from resyncing? ... (microsoft.public.vb.database.ado)