Search code examples
delphidelphi-xe2firedac

Delphi Firedac Update don't apply modified


I can not update rows in the database with the following instructions:

fdquery1.Edit;  
fdquery1.fieldByName('prova').AsString := 'asdasd';

fdquery1.Open;

Why? i must use another property of TFDQuery for changes to take effect


Solution

  • After TDataSet.Edit you must call TDataSet.Post to persist the changed values.

    fdquery1.Edit;  
    fdquery1.fieldByName('prova').AsString := 'asdasd';
    fdquery1.Post;
    

    The documentation also has a sample for that

    BTW: I am not sure why you want to open the dataset again?