Thread: RST.Addnew in combination with Limit 1.

RST.Addnew in combination with Limit 1.

From
"Vellinga, Fred"
Date:

Hi,

I want to use the ADODB object model to do updates etc. I use MSaccess as frontend, but I guess it will fail on any frontend that supports ADODB.

However the following code does not do the update.

Set RST = New ADODB.Recordset
RST.Open "SELECT FldPtr FROM TblTown LIMIT 1;", CNN, adOpenKeyset, adLockOptimistic, adCmdText
RST.AddNew
RST.Fields("FldPtr").Value = 1
RST.Update

The following does however the work:

Set RST = New ADODB.Recordset
RST.Open "SELECT FldPtr FROM TblTown;", CNN, adOpenKeyset, adLockOptimistic, adCmdText
RST.AddNew
RST.Fields("FldPtr").Value = 1
RST.Update

Is this a bug in the LIMIT operator? The advantage of LIMIT 1 is that only one record in sent over the wire. The code fails at the moment the RST.update statement is called.

Anyway, I am new to PostgreSQL, but the ADODB works very fine with PostgreSQL.
 
Thanks,
Fred