pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
VB Resync
4+ messages / 2 participants
[nested] [flat]

* VB Resync
@ 2003-06-12 15:53  MRGonzalez <magotemp@hotmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: MRGonzalez @ 2003-06-12 15:53 UTC (permalink / raw)
  To: pgsql-odbc

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

Attachments:

IMSTP.gif (image/gif, 494B) download view image
BackGrnd.jpg (image/jpeg, 1.4K) download view image
^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: VB Resync
@ 2003-06-12 16:01  Chris Gamache <cgg007@yahoo.com>
  parent: MRGonzalez <magotemp@hotmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Chris Gamache @ 2003-06-12 16:01 UTC (permalink / raw)
  To: MRGonzalez <magotemp@hotmail.com>; pgsql-odbc


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 <magotemp@hotmail.com> 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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: VB Resync
@ 2003-06-12 18:34  MRGonzalez <magotemp@hotmail.com>
  parent: Chris Gamache <cgg007@yahoo.com>
  0 siblings, 1 reply; 4+ messages in thread

From: MRGonzalez @ 2003-06-12 18:34 UTC (permalink / raw)
  To: cgg007@yahoo.com; pgsql-odbc

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 <magotemp@hotmail.com> 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 

Attachments:

IMSTP.gif (image/gif, 494B) download view image
^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: VB Resync
@ 2003-06-12 21:32  Chris Gamache <cgg007@yahoo.com>
  parent: MRGonzalez <magotemp@hotmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Chris Gamache @ 2003-06-12 21:32 UTC (permalink / raw)
  To: MRGonzalez <magotemp@hotmail.com>; pgsql-odbc

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 <magotemp@hotmail.com> 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 <magotemp@hotmail.com> 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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2003-06-12 21:32 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-06-12 15:53 VB Resync MRGonzalez <magotemp@hotmail.com>
2003-06-12 16:01 ` Chris Gamache <cgg007@yahoo.com>
2003-06-12 18:34   ` MRGonzalez <magotemp@hotmail.com>
2003-06-12 21:32     ` Chris Gamache <cgg007@yahoo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox