display the item in tdbmemo from combobox
Posted
by zizil
on Stack Overflow
See other posts from Stack Overflow
or by zizil
Published on 2010-06-17T03:13:31Z
Indexed on
2010/06/17
3:23 UTC
Read the original article
Hit count: 212
delphi
i have combobox that have value category1 and category2...the category1 have items like pencil,food,magazine,newspaper... when i choose category1, i want to retrieve the items in tdbmemo.then the same items in tdbmemo i want to display in checklistbox...i dont know how to do...i use clcat.items.add to display the item but the items is not display
procedure TfrmSysConfig.FillInCheckListClCat;
var
sTable : string;
sqlCat : TIBOQuery;
iIndex :integer;
lstCat : TStringList;
begin
if tblMain.FieldByName('POS_ReceiptCatBreakDown').AsString <> '' then begin
sqlCat := TIBOQuery.Create(nil);
sqlCat.IB_Connection := dmMain.db;
lstCat := TStringList.Create;
try
sqlCat.SQL.Text := 'SELECT code FROM ' + cboCategory.Value;
sqlCat.Open;
while not sqlCat.Eof do begin
clCat.Items.Add( sqlCat.FieldByName( 'Code' ).AsString );
sqlCat.Next;
end;
finally
lstCat.Free;
sqlCat.Free;
end;
end;
end;
© Stack Overflow or respective owner