Re: Nextval & Currval
От | A. Kretschmer |
---|---|
Тема | Re: Nextval & Currval |
Дата | |
Msg-id | 20080610102951.GD25980@a-kretschmer.de обсуждение исходный текст |
Ответ на | Nextval & Currval ("Shavonne Marietta Wijesinghe" <shavonne.marietta@studioform.it>) |
Список | pgsql-sql |
am Tue, dem 10.06.2008, um 11:56:39 +0200 mailte Shavonne Marietta Wijesinghe folgendes: > Hello > > I'm using Nextval and Currval in my ASP programme. But everytime i run the code > only the nextval record is inserted and the currval record is lost. I wrote the > INSERT INTO in the log and when i tried it via pgadmin both the records were > inserted correctly, so there is no syntax error. > I thought the problem would be the connection to the DB. I connect to the DB in > the same ASP page where I do the INSERT INTO. > > What am i doing wrong?? Any ideas anyone?? I don't know your code, but nextval() returns the next sequence number from a sequence and currval() returns the last with nextval() generated sequence-number WITHIN THIS SESSION. In a new session you can't use currval() first, you need to call nextval() and later you can use currval(). Regards, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
В списке pgsql-sql по дате отправления: