Board index » delphi » Master-Detail problem

Master-Detail problem

Hi

I have a problem using the same Master-Detail relation (same tables)
twice in my application at the same time. I'm using Delphi3 professional
and a Oracle Database. I can open the tables in any order but the second
relation to be open always gives an error: 'Index not Found'. It's a BDE
problem, the native error code is 0.

By the way I would like to have several TDBGrid's with different records
from the same table (for instance, in the first grid employers with a
salary superior to x and in the second employers with a lower income).
Is it possible with a single TTable or not?

Gon?alo
jredo...@student.dei.uc.pt

P.S.
Did I just spoke in English or was I using an unknown language?

 

Re:Master-Detail problem


Quote
>Hi

>I have a problem using the same Master-Detail relation (same tables)
>twice in my application at the same time. I'm using Delphi3 professional
>and a Oracle Database. I can open the tables in any order but the second
>relation to be open always gives an error: 'Index not Found'. It's a BDE
>problem, the native error code is 0.

>By the way I would like to have several TDBGrid's with different records
>from the same table (for instance, in the first grid employers with a
>salary superior to x and in the second employers with a lower income).
>Is it possible with a single TTable or not?

Your first problem is probably related to how you are trying to connect the
master/detail relationship.  How do you have the tables connected(Master
source, master fields)?  If you do not have them connected on what is a key for
both tables you will run into problems.  Also you said that you are opening the
same tables twice in your application.  Are you using a datamodule for the
tables?  One of the problems you could have as well is having the same record
updated close to one another and one update would overwrite the second.

You second issue could be solved by filters or by using a TQuery instead of a
TTable.

The Sql for using a TQuery would look something like these:

Select * from YourTable where Salary > X

Select * From YourTable where Salary < X

Whereas a filter would look something like this:

Filter := 'Salary > X'
Filter := 'Salary < X'

********************************
Michael Glatz              
glatzfa...@aol.com
mgl...@briefcase.com
Accept that some days you're the pigeon,
some days you're the statue.

Re:Master-Detail problem


Quote
Glatzfamly wrote:

> Your first problem is probably related to how you are trying to connect the
> master/detail relationship.  How do you have the tables connected(Master
> source, master fields)?  If you do not have them connected on what is a key for
> both tables you will run into problems.  Also you said that you are opening the
> same tables twice in your application.  Are you using a datamodule for the
> tables?  One of the problems you could have as well is having the same record
> updated close to one another and one update would overwrite the second.

I'm using several TTables to access the same table in the Oracle Server. The all
point was to allow the user to see different records of the same table, and
detailed information, at the same time. All the updates would be made in a form in
ShowModal mode so there shouldn't be a problem in the updates.
I was using the master source, master fields and that worked fine for the first
form (I have a datamodule for each form) but when I tried to open the second form
the 'Index not Found' error occurred. No mater the order, the second form to be
opened causes the error.
Then I tried to see the content of the table with the database explorer, with the
application running and one form opened and the explorer could not open the table
(error message: 'Index not Found'). Then I used sql (select * from table) and that
worked fine.

Quote

> You second issue could be solved by filters or by using a TQuery instead of a
> TTable.

> The Sql for using a TQuery would look something like these:

> Select * from YourTable where Salary > X

> Select * From YourTable where Salary < X

> Whereas a filter would look something like this:

> Filter := 'Salary > X'
> Filter := 'Salary < X'

The point was to avoid the use of two TTable's or TQuery's. Each time I make a
change in one grid I would like to see the other one updated automatically if
necessary.

Gon?alo

Quote

> ********************************
> Michael Glatz
> glatzfa...@aol.com
> mgl...@briefcase.com
> Accept that some days you're the pigeon,
> some days you're the statue.

Other Threads