Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read ID after .update

Status
Not open for further replies.

TLowder

Programmer
Mar 20, 2002
224
0
0
Hello,
I'm new to PostgreSQL and am converting from MySQL, using VB6. I ussually do something like this to read the id of the new record.

Code:
Rec.CursorLocation = adUseClient

sql = "Select * From MyTbl"

Rec.Open Sql, GCon, adOpenForwardOnly, adLockOptimistic

rec!addnew

rec!whatever = WhateverVal

Rec.Update
        
MsgBox Rec!ID 'This works in MySQL, PostgreSQL returns 0

The id field is set up as follows and it does auto increment, but I just can't read the ID after the .Update
Code:
ALTER TABLE Mytbl ADD COLUMN id integer;
ALTER TABLE Mytbl ALTER COLUMN id SET NOT NULL;
ALTER TABLE Mttbl ALTER COLUMN id SET DEFAULT nextval('Mytbl_id_seq'::regclass);

Thanks,

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top