Hi, I need your help - I have a firebird database (I guess it does not matter that it is a firebird database or another type of database) and I want to import some data of the database during program execution to an array.
at the moment i have followed the example in this lazarus tutorial
http://wiki.freepascal.org/SQLdb_Tutorial1and in my app I am using this code to extract data from database
FireBirdDataBase.SQLQuery1.Close;
FireBirdDataBase.SQLQuery1.SQL.Text := 'select Protos from results where AA=1';
FireBirdDataBase.DBConnection.Connected := True;
FireBirdDataBase.SQLTransaction1.Active := True;
FireBirdDataBase.SQLQuery1.Open;
Testprint_results.caption := FireBirdDataBase.SQLQuery1.FieldByName('Protos').AsString;
FireBirdDataBase.SQLQuery1.Close;
FireBirdDataBase.SQLTransaction1.Active := False;
FireBirdDataBase.DBConnection.Connected := False;
By this way that I use, I copy only 1 database cell at a time and I believe this takes much longer than to read more database cells at once and send them in an array in my program for further calculations. I have very small database and lazarus knowledge and i can not find it out myself.
My database data looks like this
(table is called results and some Fields are)
AA Date Protos Defteros Tritos Tetartos Pemptos Bonus
(some example data can be seen below)
1 16.11.1997 32 18 12 5 20 2
2 21.11.1997 13 21 9 17 45 6
Can you please give me an example according above, how can I read data from many database cells at once ( Protos, Defteros, Tritos, Tetartos, Pemptos) lets say where AA=1 and AA=2 and copy them to an array.
I mean i need in this example array
var
pkas : array[1..3000,1..5] of 1..45;
I mean I need my array to have these values after reading the database
pkas[1,32] pkas[1,18] pkas[1,12] pkas[1,5] pkas[1,20]
pkas[2,13] pkas[2,21] pkas[2,9] pkas[2,17] pkas[2,45]