Note that there are some explanatory texts on larger screens.

plurals
  1. PODelphi how to save 3 datasources with one save button?
    primarykey
    data
    text
    <p>I got a problem with saving all values from 3 datasources into a SMDBGrid with another datasouce.</p> <p>I got AdressID, ContactpersonID and RelationID.</p> <p>Those all dont match each others.</p> <p>The problem is that my SMDBGrid has another datasource then those 3. I wanna save them with one button.</p> <p>Tried many ways but can't find a good result.</p> <p>this is the code i use right now for my <code>Insert</code> button:</p> <pre><code>procedure TFRelatiebeheer.ToolButton1Click(Sender: TObject); begin DRelatiebeheer.ContactpersonID.Insert; DRelatiebeheer.RelationID.Insert; DRelatiebeheer.AdressID.Insert; end; </code></pre> <p>This is the code i use for my save button right now</p> <pre><code> if (DRelatiebeheer.ContactpersonID.State in dsEditModes) then if not (DRelatiebeheer.ContactpersonID.State in [dsInsert]) then begin KJSMDBGrid1.RefreshData; KJPanel4.Visible := True; end else begin if (DRelatiebeheer.ContactpersonID.State IN dsEditModes) then DRelatiebeheer.ContactpersonID.Post; if (DRelatiebeheer.AdressID.State IN dsEditModes) then DRelatiebeheer.AdressID.Post; end; </code></pre> <p>Hope you have a good sight for what I am doing right now, if not please notify.</p> <p>I got the problem with the datasources that need to be saved on 1 click and then be refreshed in the database and in the Grid. That means that when I insert a Contactperson there needs to be a AdressID and a RelationID coupled with it. After that the grid needs to reload all of the data.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload