Solved

Using SQl In My Delphi Code

Posted on 2003-11-04
6
287 Views
Last Modified: 2010-05-18
How Can I  assign Sql Functions Or out Put To a ver. in My code For Delphi 7
0
Comment
Question by:zayn
  • 2
6 Comments
 
LVL 2

Expert Comment

by:Moroni24
ID: 9682288
Can you explain you question a bit further?
0
 
LVL 6

Accepted Solution

by:
swift99 earned 63 total points
ID: 9683307
I think he means embedded SQL as in COBOL and some C compilers.

EXEC SQL
    SELECT *
    into rec.a, rec.b, rec.c
    from mytable
    where condition=true
END EXEC

There is a Pascal precompiler with Firebird for doing embedded SQL.  It is extremely uncommon in the Delphi world, and Java has followed a similar model to the one that Delphi created, so embedded SQL is not necessarily going to be around very long outside of the mainframe world.
0
 

Author Comment

by:zayn
ID: 9690167
How Can I  assign Sql Functions Or out Put To a  VARIABLE  in My code For Delphi 7
0
 
LVL 2

Assisted Solution

by:Moroni24
Moroni24 earned 62 total points
ID: 9690211
If you're using a TQuery, you can do something like

var
  qry : TQuery;
  x : string;
begin
  try
    qry := TQuery.Create(nil);
    qry.DatabaseName := yourdbname;
    with qry.SQL do begin
      Add(' call myprocedure ');
    end
   qry.ExecSQL
   while not qry.eof do begin
      x :=  qry.FieldByName('name').AsString
    end;
  finally
    FreeAndNil(qry);
  end;
end;
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

Suggested Solutions

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

786 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