Link to home
Start Free TrialLog in
Avatar of Jaymol
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:='RelevantAliasName';
     SQL.Add('Select CustomerName from CustomerDetails where AccountNumber='''+sAccNum+'''');
     ExecSQL;
     Result:=??????????;
     free;
   end;
 end;

so that I can simply do something like....

  ShowMessage(GetCustomerName('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.
ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jaymol
Jaymol

ASKER

Thanks Meikl.

Quite annoying that I'd already tried that and it hadn't worked!  (Only difference was the check IsEmpty.)

Thanks again,

John.