[solved] Sqlite SELECT problem lazarus / 16-Databases ---------------------------------------------------------------------- oldfart · 2021-10-08 14:40 returning empty string Program contains create and insert procedures - all working correctly I want to return the first value in the database: SqlQuery1.SQL.Text := 'select id, cert_number from certificates LIMIT 1;' SQLite3Connection1.Open; SQLTransaction1.Active := true; SqlQuery1.Open; temp:= SQLQuery1.Fields.FieldByNumber(2).AsString; ---------------------------------------------------------------------- JanRoza · 2021-10-08 15:28 If you want the first value in the database then why not simply use 'SqlQuery1.First'? ---------------------------------------------------------------------- dseligo · 2021-10-08 16:09 I never used FieldByNumber, but try 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 temp:= SQLQuery1.Fields[1].AsString;or 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 temp:= SQLQuery1.FieldByName('cert_number').AsString; Are you sure you have something in record? Try to see id field. Also check if you have result with Eof: 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 If SQLQuery1.Eof then showmessage('nothing found in query'); ---------------------------------------------------------------------- oldfart · 2021-10-08 16:44 Thanks for the replies, had gone through all those options .. turns out after half a day of messing with this, I had cocked up with the field type. Amended it and now everything working!! Thanks again for the speedy replies