Board index » delphi » ado/sqlserver + joins !!?!?
david
![]() Delphi Developer |
ado/sqlserver + joins !!?!?2003-10-16 11:23:00 PM delphi65 Hello I have a grid with a query and I'd like to update fields manually everything works fine, but I cannot resync current record after my beforepost event. If I call Refresh methode everything works but there are a lot of records. I join my query et my event Can someone give me a solution. thanks with friendly :'( :'( :'( :'( :'( :'( :'( select v1.idvente,v1.idcontact,r1.residence,l1.numero,p1.promoteur,s1.idsuivicontratassifc, s1.da{*word*249}voiclient, s1.datesignatureclient, s1.da{*word*249}voicompagnie, s1.dateretourcompagnie, s1.da{*word*249}voiclientfinal, s1.datefacturation from t_vente v1 inner join t_lot l1 on v1.idlot = l1.idlot inner join t_tranche t1 on l1.idtranche = t1.idtranche inner join t_residence r1 on t1.idresidence = r1.idresidence inner join t_promoteur p1 on r1.idpromoteur = p1.idpromoteur left outer join t_suivicontratassuranceifc s1 on v1.idcontact=s1.idcontact and v1.idvente=s1.idvente where v1.dateannulation is null and v1.dateacte is not null and v1.datevente>'01/01/2003' procedure TFSuiviAssuranceIFC.qryDetailBeforePost(DataSet: TDataSet); var oQry: TREMQuery; i: integer; begin inherited; oQry:= TREMQuery.Create(Self); oQry.Connection := TREMQuery(DataSet).Connection; oQry.SQL.Clear; if DataSet.FieldByName('idsuivicontratassifc').IsNull then begin oQry.SQL.Add('insert into t_suivicontratassuranceifc (idcontact, idvente, da{*word*249}voiclient, '); oQry.SQL.Add(' datesignatureclient, da{*word*249}voicompagnie, dateretourcompagnie, da{*word*249}voiclientfinal)'); oQry.SQL.Add('values (:idcontact, :idvente, :da{*word*249}voiclient, '); oQry.SQL.Add(' :datesignatureclient, :da{*word*249}voicompagnie, :dateretourcompagnie, :da{*word*249}voiclientfinal)'); end else begin oQry.SQL.Add('update t_suivicontratassuranceifc set idcontact=:idcontact,'); oQry.SQL.Add(' idvente=:idvente, da{*word*249}voiclient=:da{*word*249}voiclient,'); oQry.SQL.Add(' datesignatureclient=:datesignatureclient,'); oQry.SQL.Add(' da{*word*249}voicompagnie=:da{*word*249}voicompagnie,'); oQry.SQL.Add(' dateretourcompagnie=:dateretourcompagnie,'); oQry.SQL.Add(' da{*word*249}voiclientfinal=:da{*word*249}voiclientfinal'); oQry.SQL.Add('where idsuivicontratassifc=:idsuivicontratassifc'); end; for i := 0 to oQry.Parameters.Count-1 do oQry.Parameters[i].Value := DataSet.FieldByName(oQry.Parameters[i].Name).Value; oQry.ExecSQL; DataSet.Cancel; Abort; (* qryDetail.RecordSet.Properties['Unique Table'].Value := 't_suivicontratassuranceifc'; qryDetail.Recordset.ReSync(adAffectCurrent, adResyncAllValues); *) end; -- o--O--o David |