community.borland.com

Article #25646: Using FreeIBComponents: an example

Problem:
This FAQ provides a brief introduction to using FreeIBComponents

Solution:
Using FreeIBComponents

Brett Bandy
September 24, 1998
   
Note:  This information pertains to Delphi.  It also assumes that you have previously installed
the FreeIBComponents and are able to use them in a delphi application.


1. Add a FIBDatabase component 
    
        Set the DBName property to the location of your database.  The syntax for this
        property is the same as InterBase's connection syntax. 
       
        Set the username and password in the DBParams property. 
        The DBParams are just the InterBase database parameter block (dpb)
        parameters.  So to set the username you would use the isc_dpb_user_name
        parameter.  Here is an example showing how to set the username and
        password 

           isc_dpb_user_name=sysdba 
           isc_dpb_password=masterkey 
            
      Alternatively, you can set the UseLoginPrompt to true and it will bring up the
      normal login box that you are acustom to seeing in Delphi. 
      
2. Add a FIBTransaction component 

      Connect the FIBTransaction component to the FIBDatabase component.  This
      can be done several ways.  If there is only going to be one FIBTransaction
      component then you can setup the component to be the FIBDatabase's default
      transaction and it will automatically link the FIBTransaction component to the
      FIBDatabase component for you.  Alternatively, you can do it in code: 

        FIBTransaction1.AddDatabase(FIBDatabase1); 
         
3. Add a FIBDataSet component 
      
      * Set the FIBDataSet's Database property to the FIBDatabase component that
         you added earlier. 
      * Set the FIBDataSet's Transaction property to the FIBTransaction component
         that you will use. 
      *  Add your SQL query to the SelectSQL property 
      
4. Add the normal data access components 
      
      *  Add a DataSource component to your project 
      *  Set the DataSet property of the DataSource component to the FIBDataSet that
          you will use 
      *  Add your visual data access components (ie DBGrid) 
      *  Set the DataSource property of the visual access components to the DataSource
          component that you will use 
      
5. Run your SQL query 
      
      Start a transaction 
      
          FIBTransaction1.StartTransaction; 
          
      Activate the query 
      
          FIBDataSet1.Active := true;
          
         
6. Repeat steps 2-5 to get a second concurrent transaction 

  

Last Modified: 24-OCT-00