Hi all
I have a GUI application that utilises various tabs (pages) and in each tab are one or more stringgrids. So there's a dozen or so of them. Each one has a different number of columns, and each one will have a different number of rows every time it is used to look at different data.
Several users have asked for the data in the stringgrids to be output to an SQLite database file.
I notice in Lazarus --> SQLDB tab --> TSQLite3Connection exists for such connectivity.
I am struggling a bit though (having never used database systems in programming) working out exactly where to start here. I get that I need an SQLite3Connection object adding to my form and then somehow I need to save the content of the stringgrids to the SQLite database. I assume a table would need to be created to represent and hold the data for each stringrid, and then somehow the content of each grid saved to the table in the SQLite DB.
I found this (
http://forum.lazarus.freepascal.org/index.php?topic=28388.0) and this (
http://forum.lazarus.freepascal.org/index.php?topic=27247.0) but due to some radactions of certain details and assumptions in the posts that make it specific to single fields or whatever, the step-by-step element is missing.
So, assuming 3 x stringgrids where one has 4 columns with 100 rows, the other has 10 columns with a thousand rows and the other has 6 columsn with 500 rows, and one TSQL3Connection property, where does one go from there? I assume the steps are : Create DB --> Connect to DB --> Write new tables to DB --> Write content of grids to DB tables --> Commit --> Disconnect. But I'm not sure how to achieve those, or where the guides are to show an example of doing that.
Lastly, AFAIK, there is no StringGrid1.SaveToSQLiteDB or equivalent. And, I am curious to know how much better\easier it may be to convert all my stringgrids to DBGrids (Data Controls --> DBGrids). Would it be as easy as Find & Replace for all my stringgrids and change to the name of a DBGrid? Or is the way the data inserted very different?
Greatful for any wisdom.
Thanks