Field of types ftString not persistent lazarus / 16-Databases ---------------------------------------------------------------------- matthijsj · 2024-10-10 07:43 I have a form with a BufDataSet, a dbGrid and a datasource connecting them. When I try to enter data in a field of type ftString, the entered data is not persistent. The data is removed when I move to the next field. What do I do wrong? ---------------------------------------------------------------------- matthijsj · 2024-10-16 12:19 I entered the following code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);begin  BufDataset1.Insert;  BufDataset1.FieldByName('Number').Value := 1000;  BufDataset1.FieldByName('Naam').Value := 'EenWaarde';  BufDataset1.Post;end;   However the field "Naam' does not save the data. ---------------------------------------------------------------------- dseligo · 2024-10-16 12:28 Post example project which shows your problem. Also provide (https://wiki.freepascal.org/Forum): - the name of your operating system - the version of your operating system - the version of your Free Pascal Compiler - the version of your Lazarus IDE ---------------------------------------------------------------------- Thaddy · 2024-10-16 12:36 Het naam veld moet een shortstring zijn. string[255] The name field should be a shortstring type with a value to the maximum you expect. Otherwise you store a pointer... ---------------------------------------------------------------------- wp · 2024-10-16 17:15 I don't see any problem with the code that you posted for TBufdataset. See attached sample project. ---------------------------------------------------------------------- Zvoni · 2024-10-17 06:18 And shouldn't he use "AsInteger", "AsString" instead of "Value"? ---------------------------------------------------------------------- rvk · 2024-10-17 07:34 Quote from: Zvoni on October 17, 2024, 08:18:40 amAnd shouldn't he use "AsInteger", "AsString" instead of "Value"? Value is a variant, so it will accept a string and convert it back to the correct fieldtype. But we haven't seen anything of the rest of the code and defined fields. (Although pushing a string into a ftInteger field via a variant will result in an exception.) ---------------------------------------------------------------------- matthijsj · 2024-10-19 13:51 Size should be given when fieldtype is ftString. ---------------------------------------------------------------------- Richard Marriott · 2024-12-16 06:20 I assume you set up the table in the IDE, so go back to the field definitions property and make sure that the definition for 'Namm" contains a size parameter (as matthijsj suggests). The other suggestions should all work. Value is a variant that contents the input to the field definition type. The only other thing I can think of is to try 'Append" rather than "Insert" in your code.