 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ian Davies Guest
|
Posted: Wed Aug 27, 2003 10:49 am Post subject: Retrieving AutoIncrement Field Value |
|
|
I am using a Postgres database accessed via the BDE and ODBC
and am trying to retrieve the value of a field that is
automatically incremented by the database server when a new
record is posted.
I have a very simple table consisting only of an id and name
fields. I have made my fields persistent and am using the
following code: -
Table1.Append;
Table1Name.AsString := 'test';
Table1.Post;
ShowMessage(Table1ID.AsString);
When I run this, the ID is always an empty string. I have set
the AutoGenerateValue of the ID field to arAutoInc but it still
doesn't work. I have moved the ShowMessage into the OnAfterPost
event handler but still no joy. I have even specifically called
UpdateCursorPos on the Dataset which, again, did not work.
Can anyone please help as this seems to be an awfully common
thing to achieve?
Thank you in advance.
Ian.
|
|
| Back to top |
|
 |
klaus kuhl Guest
|
Posted: Wed Dec 31, 2003 3:39 pm Post subject: Re: Retrieving AutoIncrement Field Value |
|
|
Select Max(ID) from tab
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|