Hi everyone!
I know the basics about working with SQLite files and I've been successful in saving and retrieving the contents of various text fields into the database. However, I'm now working on a part of my programme that involves many different screens with check boxes on them, the state of which needs to be saved into one big table in an SQL file. I thought this would be pretty much the same deal as saving the contents of a text file to a database, but it's causing me headaches.
Firstly, from what I understand, SQLite doesn't accept boolean types (what the hell....?) but I've set up the fields just as text, into which I will save true or false. I can actually set up a field as a 'BOOLEAN' type but it doesn't seem to behave like one. Anyway....
UserFileSave is a TSQLQuery. I've tried various methods of getting the state of all the checkboxes on the current page and saving them. First I tried a 'save' button that collected all of them in one go. Now I've tried putting this code in the MouseUp for each check box:
if PRCheckBox.Checked=true then UserFileSave.Params.ParamByName('PRParam').AsString := 'true';
if PRCheckBox.Checked=false then UserFileSave.Params.ParamByName('PRParam').AsString := 'false';
PRParam is a parameter that I've defined in the UserFileSave, using the object inspector. When it comes to save the file, the save code will match up each parameter with the correct field in the database.
It compiles, but when I click the checkbox, Lazarus blows up and says "Project raised exception class 'EDatabaseError' with message: 'Parameter PRParam not found". It's THERE in the object inspector, poopyhead! What's going on?