I am using the ZeosLib component to access a MySql database which I believe has similar functions to the Delphi SQL components. Although I can run the queries I am not exactly sure How I can get the result of a query and use it for a second query.
Code so far------------------------------------------------
Assignfile(CdrText, CdrImportEdit.Text);
Reset(CdrText);
while not EOF(CdrText) do begin
ReadLn (CdrText, Buffer1);
ExtVar := PhoneNum(buffer1);
Exten := ExtNum(buffer1);
for i := strlen(Pchar(ExtVar)) downto 1 do
begin
areacode := copy(ExtVar,0,i);
ZReadOnlyQuery1.Close;
ZReadOnlyQuery1.ParamByName('AREACODE').AsString := areacode;
ZReadOnlyQuery1.open;
if ZReadOnlyQuery1.RecordCount > 0 then
break;
band := ZReadOnlyQuery1.results[0];<b> this is where I would like to assign the results of the first query to a var</b>
end;
continue;
CloseFile(CdrText);
end;
--------------------------------------------------------
WhaDaYaTink?
Code so far------------------------------------------------
Assignfile(CdrText, CdrImportEdit.Text);
Reset(CdrText);
while not EOF(CdrText) do begin
ReadLn (CdrText, Buffer1);
ExtVar := PhoneNum(buffer1);
Exten := ExtNum(buffer1);
for i := strlen(Pchar(ExtVar)) downto 1 do
begin
areacode := copy(ExtVar,0,i);
ZReadOnlyQuery1.Close;
ZReadOnlyQuery1.ParamByName('AREACODE').AsString := areacode;
ZReadOnlyQuery1.open;
if ZReadOnlyQuery1.RecordCount > 0 then
break;
band := ZReadOnlyQuery1.results[0];<b> this is where I would like to assign the results of the first query to a var</b>
end;
continue;
CloseFile(CdrText);
end;
--------------------------------------------------------
WhaDaYaTink?