Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread autoinc value in AfterPost after Insert
Mon, May 19 2008 5:24 PMPermanent Link

"Royke"
I have a table with an autoinc field. When we insert a new record, and then
check the value of this autoinc field during the subsequent AfterPost, its
value is 0. Later on inspecting the values using the EDBManager, they look
ok (35, 36, 37,... for a small table).

Is there any explanation for this behavior? Are these values generated only
after the AfterPost event resulting from Insert+Post?

RoyJ

Mon, May 19 2008 5:36 PMPermanent Link

"Royke"
"Royke" <royke@canada.com> wrote in message
news:008325DC-355A-4DA7-A481-FCC4A0522CD2@news.elevatesoft.com...
>I have a table with an autoinc field. When we insert a new record, and then
>check the value of this autoinc field during the subsequent AfterPost, its
>value is 0. Later on inspecting the values using the EDBManager, they look
>ok (35, 36, 37,... for a small table).
>
> Is there any explanation for this behavior? Are these values generated
> only after the AfterPost event resulting from Insert+Post?
>
> RoyJ

I can be a bit more specific. If we add records 'manually', say in a grid,
all works fine. 38, 39, 40, ..., as see nin the AfterPost.

If I add records in a loop in code, 0, 0, 0, ... Later on, the values turn
out to be 41, 42 ,43, ... What is it that we can have set incorrectly?

(I do need to have the correct value during the AfterPost event for other
purposes.)

RoyJ

Mon, May 19 2008 5:55 PMPermanent Link

"Royke"
Fixed. The table involved is a detail table, and the records being inserted
were for a different master record than the current master record. Now I do
a Locate onm the master first, before doing the insert. This is instead of
just inserting, and then changing the keyfield value. (Which has always
worked under the BDE ...)

RoyJ

"Royke" <royke@canada.com> wrote in message
news:9195A2C8-5526-4D31-B8E2-F9EF986668F3@news.elevatesoft.com...
> "Royke" <royke@canada.com> wrote in message
> news:008325DC-355A-4DA7-A481-FCC4A0522CD2@news.elevatesoft.com...
>>I have a table with an autoinc field. When we insert a new record, and
>>then check the value of this autoinc field during the subsequent
>>AfterPost, its value is 0. Later on inspecting the values using the
>>EDBManager, they look ok (35, 36, 37,... for a small table).
>>
>> Is there any explanation for this behavior? Are these values generated
>> only after the AfterPost event resulting from Insert+Post?
>>
>> RoyJ
>
> I can be a bit more specific. If we add records 'manually', say in a grid,
> all works fine. 38, 39, 40, ..., as see nin the AfterPost.
>
> If I add records in a loop in code, 0, 0, 0, ... Later on, the values turn
> out to be 41, 42 ,43, ... What is it that we can have set incorrectly?
>
> (I do need to have the correct value during the AfterPost event for other
> purposes.)
>
> RoyJ
>
>

Image