Delphi-Kylix
  Home arrow Delphi-Kylix arrow Page 3 - Creating Reports with Delphi and ADO
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DELPHI-KYLIX

Creating Reports with Delphi and ADO
By: Jacques Noah
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 9
    2006-10-16

    Table of Contents:
  • Creating Reports with Delphi and ADO
  • ADO with Rave Reports
  • Building the application
  • Defining the Layout

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Creating Reports with Delphi and ADO - Building the application


    (Page 3 of 4 )

    So without further ado, let's build a new application. Drop an ADO query (rename to q1) and from the Rave tab drop a TRvSystem (rename to rsys) component. Connect the ADO query component to the database using the connectionstring property. Refer to the previous articles if you don't know how to create a connectionstring. Then add a memo, a tedit box and a button. The memo is going to take our SQL statement and the tedit is going to take the parameter.

    Your form should now look something like this:

    Here's an example SQL statement:

    Select * from person WHERE surname=:sname

    q1.Parameters.ParamByName('sname').value:=edit1.Text;

    The entire query is called a SQL statement. Notice the highlighted ":sname;" that is what we refer to as a parameter, which is like a variable. The value for the variable is given in the line "q1.Parameters.ParamByName ('sname').value:=edit1.Text;". In the previous article we hard coded this variable value as "Smith," but in this application we are going to make it more flexible by enabling you to enter a value in the edit box.

    Why am I using the ADO query component? A query provides you with the means to interrogate a database to get any kind of information you want from it. For example, if you just want a list of all the people in the database who occupation is laborer, then a query would be able to extract that information for you. Most other ADO components don't do this. The application that is included in this article is specifically designed to enable you to have the flexibility to extract information from the database in whatever fashion you like.

    Double click on the button and add the following code:

    procedure TForm1.Button2Click(Sender: TObject);
    begin
     q1.Close;
      q1.SQL.Add(memo1.lines.text);
      q1.Parameters.ParamByName('sname').value:=edit1.Text;
      q1.Open;
        RSys.Execute;
    end;

    What is happening here? This code does two things:

    First it runs a query, which is defined in the memo and tedit and stores the results in the query component. Second, it runs the report system, by calling the execute method of the rsys component.

    More Delphi-Kylix Articles
    More By Jacques Noah


       · I hope you found my article educational; I welcome your comments.
       · Hi!.I'm have programe writeln by kylix 3.0, beacause i want to printing some field...
       · Delphi 8 and higher now comes with a new reporting component called Crystal reports....
     

    DELPHI-KYLIX ARTICLES

    - Loading an XML Document into the DOM
    - Delphi Wrapper Classes and XML
    - Delphi and the DOM
    - Delphi and XML
    - Internet Access: Client Service
    - Finishing the Client for an Internet Access ...
    - The Client for an Internet Access Control Ap...
    - User Management for an Internet Access Contr...
    - Important Procedures for an Internet Access ...
    - Server Code for an Internet Access Control A...
    - Constructing the Interface for an Internet A...
    - Building a Server Application for an Interne...
    - Building an Internet Access Control Applicat...
    - Client Dataset: Working with Data Packets an...
    - Using the Client Dataset in an N-Tiered Appl...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek