Jaymol
asked on
TQuery results.
Hi.
I've got an application I'm working on and I need to do the following...
function GetCustomerName(sAccNum: String): String;
begin
with TQuery.Create(nil) do begin
DatabaseName:='RelevantAli asName';
SQL.Add('Select CustomerName from CustomerDetails where AccountNumber='''+sAccNum+ '''');
ExecSQL;
Result:=??????????;
free;
end;
end;
so that I can simply do something like....
ShowMessage(GetCustomerNam e('1234')) ;
The problem I have is the results line. Can someone tell me how to reference the results that I glean in this manner? (I've tried referencing the TFields property, Fields, but there appears to be nothing in it.)
Thanks,
John.
I've got an application I'm working on and I need to do the following...
function GetCustomerName(sAccNum: String): String;
begin
with TQuery.Create(nil) do begin
DatabaseName:='RelevantAli
SQL.Add('Select CustomerName from CustomerDetails where AccountNumber='''+sAccNum+
ExecSQL;
Result:=??????????;
free;
end;
end;
so that I can simply do something like....
ShowMessage(GetCustomerNam
The problem I have is the results line. Can someone tell me how to reference the results that I glean in this manner? (I've tried referencing the TFields property, Fields, but there appears to be nothing in it.)
Thanks,
John.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Quite annoying that I'd already tried that and it hadn't worked! (Only difference was the check IsEmpty.)
Thanks again,
John.