Insert new record TDbf fails [solved] lazarus / 16-Databases ---------------------------------------------------------------------- mig-31 · 2013-06-27 13:30 What is happens with TDbf? When I want to insert a new record into DBF file I get exception "Dataset is readonly". My code: Table.Open; Table.Insert; Table.Fields.Fields[0].Value:='New string'; Table.Post; Table.Close; Lazarus 1.1 svn. 39507 Win32 ---------------------------------------------------------------------- Leledumbo · 2013-06-27 15:35 AFAIK Open - Close is for reading, Insert -> Post is for inserting row, do not mix them. e.g.: Code: [Select]Table.Open; // read and do something with it Table.Close; // insert new row Table.Insert; Table.Fields.Fields[0].Value:='New string'; Table.Post; ---------------------------------------------------------------------- mig-31 · 2013-06-27 17:13 Thank you for the answer, but  debugger stops on the line Table.Insert. Code: [Select]  Table.Open;   Table.Insert;   Table.Fields.Fields[0].Value:='New string';   Table.Post; ---------------------------------------------------------------------- Leledumbo · 2013-06-28 00:19 Don't call Open prior to Insert, ensure it's Close-d as well. ---------------------------------------------------------------------- bambamns · 2013-06-30 17:45 Does anyone using that DBF file beside yours application ? This message is usually present if someone else opened DBF file with exclusion wrights. ---------------------------------------------------------------------- mig-31 · 2013-07-01 15:04 No only my application use table. There is full part of code what I use. Code: [Select]  Pomtab:=TDbf.Create(Nil);   Pomtab.TableLevel:=4;   Pomtab.TableName:=ExtractFilePath(Application.ExeName)+'pomtabserii. dbf';   try     with Pomtab.FieldDefs do  begin        Add('CISODJ',ftfloat,8);        Items[0].Precision:=2;        Add('SERIE',ftstring,6);        Add('POCET',ftinteger,4);        Add('DATUM',ftDate);        Add('Record', ftInteger,8);      end;   Pomtab.CreateTable;   Pomtab.Open;   Pomtab.Insert;    Pomtab.Fields.Fields[1].Value:='Newval';   PomTab.Post;   except   on E:Exception do     ShowMessage(E.Message);  end;  PomTab.Free;                                                            But I get debug message Dataset is read-only. I try it on Win32 and Linux64 Can anyone check it? ---------------------------------------------------------------------- bambamns · 2013-07-02 19:15 I've compiled your code with replaced line : Code: [Select]Table.Post; with : Code: [Select]Pomtab.Post; Everything is ok. Did you tried to put exe in some other folder like c:\Temp ? ---------------------------------------------------------------------- mig-31 · 2013-07-03 08:33 Thank you for help. I try it using a stable Lazarus version 1.0.10 under Windows 7 32 bit. It works correctly. Probably bug is in my svn. Lazarus version.