ST3VO
asked on
SQL Query assistance needed - Populate var with Query result
Hi experts,
I'm a bit stuck here.
I want to look for a the company name of an accountID
So I thought I'd do a query.
See code:
The problem is that I wanted to assign the result to a variable (opened to suggestions here).
So, I can then assign the result to a Label.caption.
I really don't know how to do this.
Could someone help please?
Thanks
ST3VO
I'm a bit stuck here.
I want to look for a the company name of an accountID
So I thought I'd do a query.
See code:
The problem is that I wanted to assign the result to a variable (opened to suggestions here).
So, I can then assign the result to a Label.caption.
I really don't know how to do this.
Could someone help please?
Thanks
ST3VO
Try
CompName:=(memo2.Text);
adoquery1.active := false;
adoquery1.SQL.Add('select CompanyName from motors where AccountID = "' +(CompName)+'"');
adoquery1.Active := true;
finally
CompName:= ADOQuery1;
Label1.Caption:=('CompName');
ADOQuery1.active := false;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
end;
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect thanks!!!
CompName := adoquery1.fieldbyname('Com