Board index » delphi » ADO, Access 2000 - inserts not showing

ADO, Access 2000 - inserts not showing

Hi,

I have two TADOQuery components connected to two separate TDataSource
components both pointing at the same table in Access 2000.

When I do an INSERT in ADOQuery1, I can see the result immediately in the
dataset for ADOQuery1. But even after a refresh or requery, I cannot see the
result in ADOQuery2. (This works under BDE)

If instead I do an EDIT to a record in ADOQuery1, it shows up in ADOQuery2
after a refresh without any problem.

Any ideas what is going on?

Thanks,
John

(using D5 under Windows 2000 SP1. Cursor Location = clUseClient, CursorType
= ctStatic)

 

Re:ADO, Access 2000 - inserts not showing


Found out what it was...ADO inserts are *so slow* that the program was
refreshing the second query even before the first one had finished inserting
the record. The slowness of ADO with Delphi is quite frightening.

What I am now puzzled about is how to stop the program until the insert has
definitely taken place?

John

Quote
"John Rossi" <jo...@psitek.removethisbit.co.uk> wrote in message

news:8n5j07$4l32@bornews.borland.com...
Quote
> Hi,

> I have two TADOQuery components connected to two separate TDataSource
> components both pointing at the same table in Access 2000.

> When I do an INSERT in ADOQuery1, I can see the result immediately in the
> dataset for ADOQuery1. But even after a refresh or requery, I cannot see
the
> result in ADOQuery2. (This works under BDE)

> If instead I do an EDIT to a record in ADOQuery1, it shows up in ADOQuery2
> after a refresh without any problem.

> Any ideas what is going on?

> Thanks,
> John

> (using D5 under Windows 2000 SP1. Cursor Location = clUseClient,
CursorType
> = ctStatic)

Re:ADO, Access 2000 - inserts not showing


Quote
"John Rossi" <jo...@psitek.removethisbit.co.uk> wrote in message

news:8nc9g8$8ss3@bornews.borland.com...

Quote
> Found out what it was...ADO inserts are *so slow* that the program was
> refreshing the second query even before the first one had finished
inserting
> the record. The slowness of ADO with Delphi is quite frightening.

> What I am now puzzled about is how to stop the program until the insert
has
> definitely taken place?

Sleep(n);

--

"Relationships are hard. It's like a full-time job, and we should treat it
like one. If your boyfriend or girlfriend wants to leave you, they should
give you two weeks' notice. There should be severance pay, and before they
leave you, they should have to find you a temp."
Bob Ettinger

Re:ADO, Access 2000 - inserts not showing


I did think about using that but the time delay would need to vary according
to machine and connection speeds. Even then, it seems to be a bit of an
undependable solution since you are *hoping* that the post will take place
within a certain amount of time...a simulataneous machine defrag, for
example, might cause a massive slowdown beyond the time limit.

What I am thinking might be one approach is to record in local variables the
data that is being posted and then set a timer going constantly requerying
the database until the data is actually found in Access and then allowing
program execution to continue.

Can anyone think of a more elegant solution using Access 2000? Any way of
getting event notifications back from an Access backend?

Thanks,
John

Quote
"DRS" <d...@removethis.ihug.com.au> wrote in message news:3999aa93_1@dnews...
> "John Rossi" <jo...@psitek.removethisbit.co.uk> wrote in message
> news:8nc9g8$8ss3@bornews.borland.com...
> > Found out what it was...ADO inserts are *so slow* that the program was
> > refreshing the second query even before the first one had finished
> inserting
> > the record. The slowness of ADO with Delphi is quite frightening.

> > What I am now puzzled about is how to stop the program until the insert
> has
> > definitely taken place?

> Sleep(n);

Re:ADO, Access 2000 - inserts not showing


I use the following code to test for the update and loop until it is
populated.  I agree, it's not so clean, but it's the best I have come
up with.  I also will be writing a timer into the code to prompt to
retry or cancel after a certain number of seconds (10 or so).  Hope
this helps!

John

            'test for value
            db.Open dbConn
            rs2.Open sql, db, adOpenForwardOnly, adLockReadOnly
Wait:
            If IsNull(rs2!FieldName) Then
                GoTo Wait
            End If

In article <8ndml1$k...@bornews.borland.com>,
  "John Rossi" <jo...@psitek.removethisbit.co.uk> wrote:

Quote
> I did think about using that but the time delay would need to vary
according
> to machine and connection speeds. Even then, it seems to be a bit of
an
> undependable solution since you are *hoping* that the post will take
place
> within a certain amount of time...a simulataneous machine defrag, for
> example, might cause a massive slowdown beyond the time limit.

> What I am thinking might be one approach is to record in local
variables the
> data that is being posted and then set a timer going constantly
requerying
> the database until the data is actually found in Access and then
allowing
> program execution to continue.

> Can anyone think of a more elegant solution using Access 2000? Any
way of
> getting event notifications back from an Access backend?

> Thanks,
> John

> "DRS" <d...@removethis.ihug.com.au> wrote in message

news:3999aa93_1@dnews...

- Show quoted text -

Quote
> > "John Rossi" <jo...@psitek.removethisbit.co.uk> wrote in message
> > news:8nc9g8$8ss3@bornews.borland.com...
> > > Found out what it was...ADO inserts are *so slow* that the
program was
> > > refreshing the second query even before the first one had finished
> > inserting
> > > the record. The slowness of ADO with Delphi is quite frightening.

> > > What I am now puzzled about is how to stop the program until the
insert
> > has
> > > definitely taken place?

> > Sleep(n);

Sent via Deja.com http://www.deja.com/
Before you buy.

Re:ADO, Access 2000 - inserts not showing


"John Rossi" wrote

Quote
> (using D5 under Windows 2000 SP1. Cursor Location = clUseClient,
CursorType
> = ctStatic)

Try changeing the above to Cursor Location = clUseServer, CursorType =
ctKeyset

I had a simular problem using clUseClient, in that, since it is only a local
subset of the table you are using it does not immediately update the Table
in the Access database.  It sometimes takes moving off the record to the
next record or adding a new record before any other component see's the
changes or additions.  As soon as I set my component to Server it fixed my
problem.

It also happened when I created a record on the Master of a Master/child
relationship.  I could not add a record to the child table until I moved off
the record and then came back to it.  It had me scratching my head for a
while on this one.

Bob Wasaff
Firetree Ltd
bwas...@suscom.net

Other Threads