Hello
I'm new using EntityDAC not know how I can have you add multiple entities?
And if I have a master-detail relationship How do I add an entity with its details?
Thank you
Add several records
Re: Add several records
Hello,
You can find samples of work with master-detail in the folder \Devart\EntityDAC\Demos\EntityDemo\.
You can find samples of work with master-detail in the folder \Devart\EntityDAC\Demos\EntityDemo\.
-
- Posts: 17
- Joined: Sat 08 Sep 2012 19:43
Re: Add several records
What occupied this was, I do not know if it's okay
I make mistake because in the model the primary key of the detail table is a numerical missing car and set Auto-Sync properties IdGenerator OnInsert and Identity.
Code: Select all
Inv := TInventario.Create;
Inv.NombreFisico := txtGuadarComo.Text;
Inv.NombreLogico := txtNombreInv.Text;
Inv.Fecha := dtpckFecha.DateTime;
Inv.UltimoCodigo := txtUltimoCodigo.Text;
Inv.UltimoTicket := StrToInt(txtTicket.Text);
Inv.Attach(Context);
Inv.Save;
for i := 0 to chklstDepartamentos.Items.Count -1 do
begin
if chklstDepartamentos.Items.Items[i].Checked then
begin
InvDepto := TInvDepto.Create;
InvDepto.IdInventario := Inv.IdInventario;
InvDepto.Depto := chklstDepartamentos.Items.Items[i].Text;
InvDepto.Attach(Context);
InvDepto.Save;
end;
end;
Re: Add several records
Please describe the needed behavior in more detail.