X-Original-To: pgsql-odbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 98AFF9FB274 for ; Tue, 22 Aug 2006 14:33:38 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 07726-06 for ; Tue, 22 Aug 2006 14:33:32 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by postgresql.org (Postfix) with SMTP id 439009FA5FB for ; Tue, 22 Aug 2006 14:33:30 -0300 (ADT) Received: (qmail invoked by alias); 22 Aug 2006 17:33:29 -0000 Received: from i3ED6CC90.versanet.de (EHLO [192.168.0.108]) [62.214.204.144] by mail.gmx.net (mp018) with SMTP; 22 Aug 2006 19:33:29 +0200 X-Authenticated: #14269776 Message-ID: <44EB410A.10809@gmx.net> Date: Tue, 22 Aug 2006 19:38:18 +0200 From: Andreas User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de-AT; rv:1.8.0.6) Gecko/20060729 SeaMonkey/1.0.4 MIME-Version: 1.0 To: pgsql-odbc@postgresql.org Subject: ADO and sequences Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.061 tagged_above=0 required=5 tests=AWL, SPF_PASS X-Spam-Level: X-Archive-Number: 200608/75 X-Sequence-Number: 8039 Hi, I'd like to write to PG from Access2000 with ADODB. I got it running, but I'd like to know the sequence-nr that gets used when a new record is created. I open a recordset with .CursorLocation = adUseClient .CursorType = adOpenStatic .LockType = adLockOptimistic then I call its AddNew method, the columns get filled and the recordset is closed. The primary key is a SERIAL. Is there a way to read the pkey before I commit the record? Access knows it's Autonumbers after AddNew when I use it's JET db-engine. A "select currval...." after the AddNew yields Error while executing the query; ERROR: currval of sequence "personen_person_id_seq" is not yet defined in this session I'd rather not use currval anyways. I'd prefer to have the program not know to much of the structure that sits in the db backend, like the sequence's name in this case. Can I get something like this : rs.AddNew lngID = rs!id rs!field1 = value1 rs!field2 = value2 .... rs.update rs.close