NullStr to NULL in SQLQuery lazarus / 16-Databases ---------------------------------------------------------------------- BSaidus · 2025-09-22 12:03 Hello. Given this 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 // v_int : TLongIntFirld// v_txtc: TStringField// v_txtt: TMemoField const  CSQL = 'INSERT INTO uc_temp (v_int, v_txtc, v_txtt) VALUES (%d, %s, %s);';var  LtextSQL: string;  Lf1: LongInt;  Lf2, Lf3: String;begin   if not TryStrToInt(Edit1.Text, Lf1) then   begin    // Lf1 = Null;  end;       Lf2 := Edit2.Text;  if Trim(Lf2) = '' then   begin    // Lf2 = Null;    end;    Lf3 := Memo2.Text;  if Trim(Lf3) = '' then   begin    // Lf3 = Null;        end;       LtextSQL := Format(CSQL, [Lf1, Lf2, Lf3]);   Memo1.Append(LtextSQL);   Self.ZQuery1.SQL.Clear; // ...  end;  My Question is, How to Convert Empty Value ( for string = '', for Integer = '' ) to Null, in order to when executing sql statement, the Empty value will be replaced by NULL. IN my exemple, I use Edit & Memo to get input values, if they are empty then I Format the query with NULL   Ie: 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     LtextSQL := INSERT INTO uc_temp (v_int, v_txtc, v_txtt) VALUES (NULL, NULL, NULL);   PS: I do not want to construct the query using string concatination. ---------------------------------------------------------------------- dseligo · 2025-09-22 12:12 Use parameters. You use them like this: 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   CSQL = 'INSERT INTO uc_temp (v_int, v_txtc, v_txtt) VALUES (:v_int, :v_txtc, :v_txtt)';...ParamByName('v_int').AsInteger := 1;ParamByName('v_txtc').AsString := 'abc';ParamByName('txtt').AsString := 'cde';  If you want null value, you do it like this: 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 ParamByName('v_int').Clear; ---------------------------------------------------------------------- BSaidus · 2025-09-22 12:17 Thank you. I'll do it like that.