delphi parameter problem

Posted on 2009-02-16
Last Modified: 2013-11-23

I would like to pas a SELECT SUM in ADOQuery to a resultant parameter as follows

SELECT SUM(Price) AS Total FROM CashDesk

But I would like to pass the Total as a parameter then to an edit box.

can any one help, sorry this isnt very clear.
Question by:DaveAM
    LVL 14

    Expert Comment

    Yes, not very clear.
    Typically, you would open your ADOQuery and then assign the value something like this
    Edit1.Text := ADOQuery1.FieldByName('Total').AsFloat;
    LVL 14

    Accepted Solution

    Sorry about that. You need to convert to string.
    Edit1.Text := FloatToStr( ADOQuery1.FieldByName('Total').AsFloat);
    Edit1.Text := ADOQuery1.FieldByName('Total').AsString;
    LVL 22

    Assisted Solution

    AfterOpen of the ADOQuery;
    Edit1.Text := ADOQuery1.FieldByName('Total').AsString;

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
    Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

    758 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

    11 Experts available now in Live!

    Get 1:1 Help Now