[Solved] Dumb SQLite question asked by an idiot lazarus / 63-Database ---------------------------------------------------------------------- heebiejeebies · 2024-12-13 20:44 Hi all, Just fixed the previous bug with the DBLookupListBox, now another bizarre one has appeared. Like the last one, I haven’t changed any of my code and this had been working for 2 years prior to upgrading Free Pascal/Lazarus version. I can’t see how fixing the last error could have affected it. Anyway, this SQLite query: 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 UserfileLoad.Open;UserFileLoad.SQL.Text:=('SELECT * FROM MasterProtocol WHERE _rowid_ = :RowParam');UserFileLoad.Params.ParamByName('RowParam').Value := IssueIndex;      if UserFileLoad.Fieldbyname('Workspace').AsString = 'True' then WorkspaceCheckbox.Checked:= true;        Now complains that the field Workspace doesn’t exist. I’ve added some debugging checks just before the code is executed, which confirm the following regarding UserFileLoad: The database name is correct; The query is correct; The query is opened without error; RowParam returns a valid record ID; The query returns all the correct fields; The dataset is active /1 record returned; and Correct data is read from the fields! My code above appears directly after the end of the successful checks; there’s nothing else in between the checks and the above.  Yet the checks work and the above code fails due to missing field. Strangest one I’ve ever seen I think?! Where do I even start? ---------------------------------------------------------------------- dsiders · 2024-12-13 20:55 Why are you opening the dataset before setting the SQL and parameter values? ---------------------------------------------------------------------- heebiejeebies · 2024-12-13 21:04 Haha, because I'm a moron, clearly. I was so hung up on why this worked previously that I didn't even notice that. Seriously though, WHY DID THIS WORK PREVIOUSLY??!!? I didn't change ANYTHING in the code. I wonder if it's something to do with the changes to the sqlite3connection class. ---------------------------------------------------------------------- dsiders · 2024-12-13 23:44 Quote from: heebiejeebies on December 13, 2024, 10:04:26 pmHaha, because I'm a moron, clearly. I was so hung up on why this worked previously that I didn't even notice that. Seriously though, WHY DID THIS WORK PREVIOUSLY??!!? I didn't change ANYTHING in the code. I wonder if it's something to do with the changes to the sqlite3connection class. I don't know, but we can't debug your code without having your code. But I will add that 'SELECT * FROM' is bad idea. Use an explicit column selection List. The design-time editors with even do it for you. ---------------------------------------------------------------------- Zvoni · 2024-12-16 07:48 Quote from: dsiders on December 14, 2024, 12:44:26 amBut I will add that 'SELECT * FROM' is bad idea. Another bad idea in SQLite is to filter on rowid. Use an explicit PrimaryKey-Column EDIT: And don't use "Value" on the Params (Line 3). Use explicit DataType... "AsInteger"