Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assigning the results of a query to a var

Status
Not open for further replies.

lloydie2

Programmer
Apr 21, 2003
75
GB
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?
 
Still did'nt get anywhere with that, so I decided to use the TMySQL component instead which sorted out my problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top