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 5F6169FA5F8 for ; Tue, 20 Jun 2006 14:08:08 -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 85425-01 for ; Tue, 20 Jun 2006 14:07:59 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.169]) by postgresql.org (Postfix) with ESMTP id 74F359F9998 for ; Tue, 20 Jun 2006 14:07:59 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id a2so2370254ugf for ; Tue, 20 Jun 2006 10:07:57 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=lO13UNeVyRIXr0hn+vZcYxQDkTwwSPHntx8QqjM5p5NaBHKFV7ail/6aRXv4Ivqv1Ox2AO8kma+bSTH/qfpJ/Msa/hpZoUT4u/VzyiK496MZLt2fEehCniZjDYjrXaJri/9kkcJOsoJr6HP90kLVjby4iWtXr01UcSuwbg1Pwc0= Received: by 10.67.97.7 with SMTP id z7mr6831847ugl; Tue, 20 Jun 2006 10:07:57 -0700 (PDT) Received: by 10.67.90.5 with HTTP; Tue, 20 Jun 2006 10:07:57 -0700 (PDT) Message-ID: <44556d330606201007w1fe11efdx5cf86c6c3a0424ae@mail.gmail.com> Date: Tue, 20 Jun 2006 10:07:57 -0700 From: "Mike Kock" To: pgsql-odbc@postgresql.org Subject: Access and autonumbers (serial) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/146 X-Sequence-Number: 7894 If I open an ODBC connection using ADO, I am able to open a recordset on a table with a serial type in it, do an AddNew, set my fields and call Update. At that point the serial field in the recordset is populated with the newly allocated value. Now, if I use Access's ADO connection object (CurrentProject.Connection) which uses ODBC linked tables (linked using the same ODBC connection string I used above) I get a "record is deleted" error when I try to access the serial field in the recordset after Update is called (running exact same code, just using a different connection object). I have tried to dig through the ODBC debug log and about the only thing I can figure out is that straight ADO does a SQL_CURSOR_TYPE = 1 while the ODBC linked tables never set the cursor type value (so it is defaulting to 0). Also with all ADO I get dequeueNeedDataCallback ret=0 count=2 after the insert (ODBC linked tables has count=0). With the non-zero count a query that looks like "SELECT * , "ctid", "primary_key_serial_field_name" FROM table_name WHERE ctid = currtid(0, '(,)')" is issued. When the count is 0 this never happens. Instead a reselect of the original recordset open SQL is issued with the extra criteria of primary_key_serial_field_name = null (since it doesn't know the new serial value). I have tried pretty much every Open recordset option with no luck. I also tried using DAO and the LastModified bookmark but this generates the exact same error. Anyone have any ideas on how to get the serial value of a newly added record from an Access ODBC linked table? Is this difference happening because Access is not setting the cursor type? Is there any way to get a different default behavior? I tried looking through the ODBC code without much luck in finding much. Thanks for any ideas or help. Mike