X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 7CCD130D1CE for ; Thu, 12 Jun 2003 21:33:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 84280-08 for ; Thu, 12 Jun 2003 18:33:00 -0300 (ADT) Received: from web13807.mail.yahoo.com (web13807.mail.yahoo.com [216.136.175.17]) by svr1.postgresql.org (Postfix) with SMTP id EEBAC30D1B0 for ; Thu, 12 Jun 2003 18:32:58 -0300 (ADT) Message-ID: <20030612213258.30244.qmail@web13807.mail.yahoo.com> Received: from [216.173.173.66] by web13807.mail.yahoo.com via HTTP; Thu, 12 Jun 2003 14:32:58 PDT Date: Thu, 12 Jun 2003 14:32:58 -0700 (PDT) From: Chris Gamache Reply-To: cgg007@yahoo.com Subject: Re: VB Resync To: MRGonzalez , pgsql-odbc@postgresql.org In-Reply-To: <3EE8C7B8.00000C.01780@GUAJ215DESA> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200306/25 X-Sequence-Number: 2999 I've experienced the same problem. To address this issue I use explicit update and insert statements using the .Execute method, and forget about ADO's .AddNew and .Update methods. dim rs dim conn set conn = createobject("adodb.connection") conn.open "[your connection string]" set rs = conn.execute("update table set column1='" & value1 & "' where id='" & id & "';") set rs = nothing conn.close set conn = nothing --- MRGonzalez wrote: > Thank you, it works. > > Now, I have a single ADO control bound to my table "clients". > To add a new record I do this: > > adoClients.Recordset.AddNew > ... block of sentences ... > adoClients.Recordset.Update > > And that works very fine. However when I make some changes > and try to update, it raises an error > > adoClients.Recordset.Update > > "Row cannot be located for updating. Some values may have been changed since > it was last read" > > Any Ideas, > Best regards, > > > MAGO > > > -------Mensaje original------- > > De: cgg007@yahoo.com > Fecha: Jueves, 12 de Junio de 2003 10:01:52 a. > A: MRGonzalez; pgsql-odbc@postgresql.org > Asunto: Re: [ODBC] VB Resync > > If you're application is designed to run only with PostgreSQL, let > PostgreSQL > keep track of the current value of the serial: > > dataenvironment.connection.execute "Insert Into Detail (FK, Field1, Field2, > FieldN) select currval('whatever_the_PK\'s_sequence_name'),'" & intData1 & > "','" & intData2 & "','" & intDataN & "');" > > HTH > > --- MRGonzalez wrote: > > I have an application where I save the information of a bill and its > detail. > > The PK of the header its a serial. > > > > I need to save the header and get the number of the serial to save it as a > > FK in the detail. > > > > This is the way I wrote but it raise an error: > > > > header.recordset.update > > header.recordset.resync adAffectCurrent, adResyncAllValues > > > > dataenvironment.connection.execute "Insert Into Detail (FK, Field1, Field2 > > > FieldN) Values (" & header.recordset!PK & "," & intData1 & "," & intData2 > & > > ," & intDataN & ")" > > > > Any suggestions? > > > > Thank you in advanced, > > > > > > MAGO > > > __________________________________ > Do you Yahoo!? > Yahoo! Calendar - Free online calendar with sync to Outlook(TM). > http://calendar.yahoo.com __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com