Board index » delphi » tADOQuery & master-detail

tADOQuery & master-detail

Hello,
I'm trying to use two ADOQuey linked in master-detail, but I've got
a problem in inserting rows.

the 1st query is like this:
-- SELECT SOGGETTO,DESCRIZIONE
-- FROM TABLE1

the 2nd query is like this:
-- SELECT CLIENTE,PAGAMENTO
-- FROM TABLE2
-- WHERE CLIENTE =:SOGGETTO

The 2nd query is connected to the 1st with the property DataSource.
The DB is MSSQl7 with Delphi5 (OS NT4).
When I try to insert a record into detail query follows this exceptoion:
"ADOQuery2: field 'SOGGETTO' not found"

If the 2nd query (detail) is like:
-- SELECT SOGGETTO,PAGAMENTO
-- FROM TABLE2
-- WHERE SOGGETTO =:SOGGETTO
(the masterfield has the same name of the detail field )
is OK but I can't change the table's structure.

Anyone has
Can I do master-detail query with fields that have the same name??

Thanks!!
Marcello

----------------------------------------------
Reparto Sviluppo - svilu...@comptech.it -
Comptech S.r.l.

 

Re:tADOQuery & master-detail


Have you tryed it this way?

 SELECT CLIENTE AS SOGGETTO, PAGAMENTO
 FROM TABLE2
 WHERE CLIENTE =:SOGGETTO

Re:tADOQuery & master-detail


Hi
If I remember correctly there was a bug in ADOQuery master detail
relationship
maybe this is why I always use the master query AfterScroll event to refresh
the data in the detail query insted of using the DataSource property

with DetailQry do begin
  if Active then Close;
  ParamByName('MasterSerial').AsInteger :=
DataSet.FieldByName('Serial').AsInteger;
  Open;
end;

Regards

      David  B.E    .agros...@arava.co.il

Quote
"El. Aziz" <gila...@azeronline.com> wrote in message

news:3acb42c7_2@dnews...
Quote
> Have you tryed it this way?

>  SELECT CLIENTE AS SOGGETTO, PAGAMENTO
>  FROM TABLE2
>  WHERE CLIENTE =:SOGGETTO

Re:tADOQuery & master-detail


Thanks for help!!

Have you note this commented block of code in ADODB.pas?
Does it tell you something??

(TCustomADODataSet)
// Add the following method to fix missing key assignment when inserting
// detail records in a client dataset provided from an ADO dataset.
// Note: This fix requires an interface change and is therefore not part of
the
//          Version 5 update pack.
// Procedure GetDetailLinkFields(MasterFields, DetailFields: TList);
override;

 Thanks!!
 Marcello

 ----------------------------------------------
 Reparto Sviluppo - svilu...@comptech.it -
 Comptech S.r.l.

Re:tADOQuery & master-detail


so...one more known bug with TADOQuery

Quote
"David B.E" <agros...@arava.co.il> wrote in message news:3acb76ce_2@dnews...
> Hi
> If I remember correctly there was a bug in ADOQuery master detail
> relationship
> maybe this is why I always use the master query AfterScroll event to
refresh
> the data in the detail query insted of using the DataSource property

> with DetailQry do begin
>   if Active then Close;
>   ParamByName('MasterSerial').AsInteger :=
> DataSet.FieldByName('Serial').AsInteger;
>   Open;
> end;

> Regards

>       David  B.E    .agros...@arava.co.il

> "El. Aziz" <gila...@azeronline.com> wrote in message
> news:3acb42c7_2@dnews...
> > Have you tryed it this way?

> >  SELECT CLIENTE AS SOGGETTO, PAGAMENTO
> >  FROM TABLE2
> >  WHERE CLIENTE =:SOGGETTO

Other Threads