Topic: Action behind button

Hello Dimitri

If I would place a nice button (with icone and picture) to remplace the gray basic button  of MVD, what would be the real syntax to place behind.

For example, in MVB, after selecting the record to delete, the button DELETE --> (Action) DELETE RECORD -> SELECT THE GRID -> , what would be the delphi syntax to perform the same result ?

Thanks for answer




Great Thanks
Jean B.

Re: Action behind button

Hello,


procedure Form1_Button5_OnClick (Sender: string; var Cancel: boolean);
var
   id: integer;
begin
   id := Form1.GridEmployees.dbItemID;
   SQLExecute ('DELETE FROM employees WHERE id = ' + IntToStr(id));
   Form1.GridEmployees.dbUpdate;
end;

Also I made for you example project, how to delete record using script.

Post's attachments

Attachment icon Delete using script.zip 4.7 kb, 575 downloads since 2014-08-19 

Dmitry.

Re: Action behind button

Hello Domitri

Thanks for your answer

In fact, I was using the same SQL instruction like yours, but I didn't think to refresh my grid.
Thanks for that

Best regards

Jean B.

Re: Action behind button

Hello Dimitri

How to create a script to create a SQL search button like using search criteria in the search ID in Table 1 for combining search and the result in Table 2, using:

SELECT *
FROM piesa,Centralizator
WHERE Centralizator.id=$id AND Centralizator.Serie_aparat=piesa.idcazan

Table 1 = Centralizator need id + condition for create search for Table 2 (Piesa)


(Click on table to give me a quest ID to use with SQL)

Thanks for blessings

Re: Action behind button

einsteinf5

You can do it without script, using button with action SQL query and using property Increm. Search of TableGrid, where you should choose button with action SQL query.


Unfortunately I can not understand your SQL query to correct it.

Dmitry.

Re: Action behind button

Hello Dimitri

I Tried hard, but are functioning only with SQL Report mergeu not with what you proposed "Increm. Search"
I used version 1.43, the proposed forum that can write in capitals "" and does not give error saving
SQL Report use that:

SELECT
piesa.id,
piesa.idcazan,
piesa.denumirecod,
piesa.dataluat,
piesa.delacine,
piesa.datapredat,
piesa.retur,
piesa.achitat,
piesa.pret,
piesa.situatie,
piesa.predatcui,
piesa.obs,
piesa.orasosire,
piesa.oraplecare,
piesa.constatare,
piesa.cauze,
piesa.lucrari,
piesa.valdeplasare,
piesa.valmanopera,
piesa.totalpret,
piesa.recomandari,
piesa.obsutilizator,
piesa.nr_raport,
Centralizator.id,
Centralizator.Nume,
Centralizator.Prenume,
Centralizator.Localitate,
Centralizator.Nr__Certificat,
Centralizator.Tip_Aparat,
Centralizator.Cod_aparat,
Centralizator.Serie_aparat,
Centralizator.Vanzator,
Centralizator.Data_Vanzarii,
Centralizator.Data_PIF,
Centralizator.Nr_Factura,
Centralizator.Tehnician_PIF,
Centralizator.SC_Service,
Centralizator.Telefon,
Centralizator.Adresa,
Centralizator.Data_inregistrarii,
Centralizator.Data_VER_VTP

FROM piesa,Centralizator
WHERE  Centralizator.id=$id AND Centralizator.Serie_aparat=piesa.idcazan

that only works using the search report, in tables do not work because I suppose there is the Options selection in tables that exist in the "SQL report" or am I missing something here

Thanks for your support!

Re: Action behind button

einsteinf5

Please, send me your project to support@drive-software.com
With description, what you need do.


Thanks.

Dmitry.