Solved

Assigning select statment result to Variable ?

Posted on 2003-12-10
3
207 Views
Last Modified: 2010-04-05
hi
can I assign  Select Statement result to spesific variable ?
for example I have Avariable M:word or Integer  and Iwant to assign this Variable the value of next statment :-
query1.SQL.add('select employee_id from emp where name=Ali');
If it is not Possible How Can I do it ?
 

0
Comment
Question by:sraab2004
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 20 total points
ID: 9912451
...
query1.SQL.add('select employee_id from emp where name=Ali');
query1.open;
IntegerVar := query1.FieldByName('employee_id').AsInteger;
query1.Close;
....

meikl ;-)
0
 

Expert Comment

by:songhd
ID: 9917733
I give u the example to solve it.

procedure TForm1.Button1Click(Sender: TObject);
var
Num:integer;//the variable to save your select result about employee_id)
begin
Query1.Close;
Query1.Clear;
Query1.SQL.Add('select employee_id from emp where name=Ali');
Query1.Open;
Num:=Query1.FieldByName('employee_id').AsInteger;
end;
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9918359
looks similar, songhd :-)
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question