Board index » delphi » UpdateSQL Inserting - don't work!

UpdateSQL Inserting - don't work!

I hav two master/detail tables
(slave sorted in desc order):
1. FIRMS (firm_id, ....) - master
2. MONEY (money-id , firm_id, summa ....) - slave

slave query:

select * from DBA."MONEY" Dba_money
where firm_id=:firm_id order by money_id desc

In UpdateSQL.InsertSQL :
insert into  DBA."MONEY" Dba_money
(  firm_id , summa )
values
(  :FIRM_ID , :summa)

But  Delphi can't automatically
put "firm_id" in UpdateSQL.Insert!

How to fix it?

FIRMS.firm_id -> MONEY -> UpdateSQL.Insert ?

Thanks...
klo...@tv-park.kiev.ua; (+38 044) 419-87-68 - work
 http://klokov.conk.com - home

 

Re:UpdateSQL Inserting - don't work!


On Mon, 1 Mar 1999 17:54:00 +0300, "Sergiy Y. Klokov"

Quote
<klo...@tv-park.kiev.ua> wrote:
>I hav two master/detail tables
>(slave sorted in desc order):
>1. FIRMS (firm_id, ....) - master
>2. MONEY (money-id , firm_id, summa ....) - slave

>slave query:

>select * from DBA."MONEY" Dba_money
>where firm_id=:firm_id order by money_id desc

>In UpdateSQL.InsertSQL :
>insert into  DBA."MONEY" Dba_money
>(  firm_id , summa )
>values
>(  :FIRM_ID , :summa)

>But  Delphi can't automatically
>put "firm_id" in UpdateSQL.Insert!

>How to fix it?

>FIRMS.firm_id -> MONEY -> UpdateSQL.Insert ?

Try assigning the new values in the OnNewRecord event for the query
which calls your UpdateSQL object.  Then your UpdateSQL should work.
Also as a suggestion (it might not matter to you) but keep parameters
and field name cases the same (I use uppercase).

e.g.
procedure TForm1.qryMoneyNewRecord(DataSet: TDataSet);
begin
  with qryMoney do
  begin
    FieldByName('FIRM_ID').AsInteger :=
qryFirm.FieldByName('FIRM_ID').AsInteger;
    FieldByName('SUMMA').AsInteger   := GetSumma;
  end;
end;

Sarky

Other Threads