Hello,
I need to generate checkboxes in delphi based on the number of data in database. and the caption has to to given to checkbox as customized by us from a database field.
It works if there is one value which is being retrieved.
suppose its a table 'crncy' with 'country' and 'currency_of_country' as columns, and a SQL query like:
select country from currency where currency_of_country='yen';
it retrieves Japan from database(i have stored it in database in prior).
I have code to display it to a TDBCheckBox component:
procedure Thome_trainee.btn_listClick(Sender: TObject);
var
c : string;
begin
SQLiteLibraryName:='sqlite3.dll';
SQLite3Connection1.DatabaseName := 'testdbase.db';
SQLite3Connection1.Transaction := SQLTransaction1;
SQLTransaction1.DataBase := SQLite3Connection1;
SQLite3Connection1.Connected:=true;
SQLTransaction1.Database:=SQLite3Connection1;
SQLQuery1.Database:=SQLite3Connection1;
SQLQuery1.SQL.text:='Select country FROM crncy';
SQLQuery1.open;
DataSource1.DataSet:=SQLQuery1;
c:= SQLQuery1.fieldbyname('country').AsString;
DBCheckBox1.DataSource:=DataSource1;
DBCheckBox1.Caption:=c;
end;
Problem is:
when i need to display array of string to different checkboxes as its caption, which is being generated dynamically,
(I know how to dynamically generate checkboxes but not its caption) what do you suggest me to do?