>I have an RV on a SQL Server table with an IDENTITY (int) field. After an add, I am trying to get the IDENTITY fields value to stuff into the RV for subsequent possible edits. I do this fine but the next tableupdate(1) always returns an Update Conflict. Is what I am trying to do possible? If so, any suggestions on what I'm doing wrong? Example of code below:
>
>append blank
>
>(... populate all the fields, except sqlupdtuid (IDENTITY field) which is the key)
>
>=tableupdate(1) && This is successful
>
>lnHandle = CURSORGETPROP("ConnectHandle", "CDMTESTTABLE")
>=SQLEXEC(lnHandle, "SELECT @@IDENTITY AS LastPK", "LastPK")
>select cdmtesttable
>replace sqlupdtuid with lastpk.lastpk
>
>=tableupdate(1) && This fails with Update Conflict
Do you have row or table buffering on your RV? Your idea cannot work for table buffering.
Btw, you may always Requery() your view to get most recent data, including identity field. Also, you better use @@SCOPE_IDENTITY instead of @@IDENTITY on SQL-Server side.
Edward Pikman
Independent Consultant