ADO and DBNavigator, wheres the first record?
From: Dominic (dommyd2_at_yahoo.com.au)
Date: 08/31/04
- Next message: Cengis: "Re: how to manage linked table with delphi / ado ?"
- Previous message: Brian Bushay TeamB: "Re: Querying two separate connections"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 31 Aug 2004 12:36:53 +0930
Hi
I am using Delphi 6 Professional, ADO, MDAC 2.71 SP1 and MS Access 2000.
In my data entry forms, I set up pseudo-master/detail relationships to
handle record navigation.
I have a ADOQuery called ADOQueryNavigate. Its role is to return a distinct
list of primary keys. It has its own DataSource object.
I then have an ADODataset called ADODatasetMain which is the dataset
responsible for data entry. It returns all the necessary fields for the
current record linked to the current record of ADOQueryNavigate.
On my Data entry form, I have only one DBNavigator linked to
ADOQueryNavigate.DataSource. So as a person scrolls through the records, the
master link changes for ADODatasetMain and the appropriate record is
displayed to the user.
I am comfortable with this logic and I have been using a similar logic with
Interbase for the last 2 years.
What I have noticed with ADO however, which I cannot replicate with
Interbase is that if I click on the next record button a couple of times and
then click on the first button, it doesn't take me to the first record
originally displayed. Instead I might need to go Next, Next, Prior, Prior,
to get back to the first record. I can "locate" the first record, so its not
like is not there but the DBNavigator or something else seems to lose it.
All tables using this logic have a unique field being returned as the only
field in ADOQueryNavigate.
A typically example may be for ADOQueryNavigate:
SELECT EMPLOYEE_NUMBER FROM EMPLOYEES AS EMPID
ORDER BY EMPLOYEE_SURNAME
Then ADODatasetMain would have a SQL of
SELECT EMPLOYEE_NUMBER,EMPLOYEE_SURNAME,EMPLOYEE_NAME,EMPLOYEE_DB
FROM EMPLOYEES WHERE EMPLOYEE_NUMBER = :EMPID
and the appropriate master field link properties are set up.
Any Ideas why the first record disappears in some cases? No filters, no
criteria on SQL apart from master/detail relationship.
Thanks
Dominic
- Next message: Cengis: "Re: how to manage linked table with delphi / ado ?"
- Previous message: Brian Bushay TeamB: "Re: Querying two separate connections"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]