Solved

Using SQl In My Delphi Code

Posted on 2003-11-04
6
284 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
Comment Utility
Can you explain you question a bit further?
0
 
LVL 6

Accepted Solution

by:
swift99 earned 63 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now