VB/ADO: AddNew does NOT increment RecordCount
Hi all,
I am working with ADO/VB6 and (frequently) using disconnected client-side recordsets. On a couple of cases I encountred this strange behavior: I use AddNew to add a record field by field but RecordCount is still 0. This is the code to create the recordset:
**********BEGIN CODE
If Not adoPrimaryCRS.State = adStateClosed Then adoPrimaryCRS.Close
With adoPrimaryCRS
'Specify the cursorâs location
.CursorLocation = adUseClient
.Open sqlPrimC, db1, adOpenStatic, adLockBatchOptimistic
End With
**********END CODE
Adding a watch (debugger): The recordset RecordCount = 0 BUT AbsolutePosition = 1! Also, the fields contain the new data just fine.
Later, when I go thru the recordset looking for new records to insert into DB, that record does not show up and is not inserted.
Usually it works fine! I have to point out that I am calling the function that contains the above code from many places.
Thank you,
Mo
|