S := 'select';
N := MergeFields.Root.FindNodes('//ROW');
for I := 0 to N.Count - 1 do
begin
S := S + #13#10#9 + N.Node[I].Attributes.Filer.ReadString('FieldName');
if I < N.Count - 1 then
S := S + ',';
end;
S := S + #13#10'from';
N := MergeJoins.Root.FindNodes('//ROW');
for I := 0 to N.Count - 1 do
begin
S := S + #13#10#9;
F := N.Node[I].Attributes.Filer;
if I > 0 then
S := S + Trim(F.ReadString('JoinType') + ' join') + ' ';
S := S + F.ReadString('TableName');
if F.ReadString('JoinOn') <> '' then
S := S + ' on ' + F.ReadString('JoinOn');
end;
S := S + #13#10'where'#13#10#9'1 = 1';
This query is automatically fed to a data thread. The query results is returned as a string containing an XML document. It is passed back from the data thread through a messaging system. You registered a window with this messaging system once, then handle the thread events. Data events include OnStart, OnFinish, OnError, and OnProgressMessage. Doc := CreateDocument;
Doc.Text := (Sender as TDataThread).Result;
FCustomerList := Doc.Root.FindNodes('//item');
Then later I can use thr result list to suit my needs. For example, to custom draw result text in a list box I use code like: F := FCustomerList.Node[Index].Attributes.Filer;
DrawCaption(DC, F.ReadString('FIRST_NAME') + ' ' + F.ReadString('LAST_NAME'),
That's basically how it works. Let me know what you think.