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.
The id field is set up as follows and it does auto increment, but I just can't read the ID after the .Update
Thanks,
Tom
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