Subscribe to our YouTube Channel for more Videos

How to use TQuery and RequestLive in Delphi 7 ?

TQuery component in Delphi enables your applications to use SQL syntax to access data from the database like paradox,Oracle etc and more importantly TQuery and RequestLive plays a very important aspect in the data retreival.

How to use TQuery and RequestLive in Delphi 7 ?

Below are the following steps to that demonstrates how to use the TQuery component .

1. Create the TQuery Component.This can be done either by dropping the component on top the designer or during the runtime

Eg :


Query1 : TQuery;

Query1 := TQuery1.Create(nil);

2. Set the DatabaseName property of the TQuery to the one that we use.

3. Add the query to the component.The query can be one that produces resultset and that dont.This is added via the property SQL.Text property of the TQuery component .

Query1.SQL.Text := 'Select name from employeetable';

4. Open the Query .

Now that we have the resultset ,we set the datasource of the DBGrid bound to the Query1 .This displays the data in the Grid .

Note that the resultset returned by the TQuery component’s Query (select statement ) is currently “ReadOnly”,where the user cannot edit the data in the Grid that has this resultset bound to it .

This is where the RequestLive property comes in to picture and helps us to make the Resultset returned as editable .

When the RequestLive property is set to true,the results are live that works similar to the TTable component where the user can edit data and when posted will immediately be updated in the database .

The query ‘select name from employeetable’ worked fine when i used it for the Paradox database,But the same query with the oracleDB and the RequestLive set to true resulted in the error “Table/View does not exist.”

This can be resolved by changing the tablename and the column names in the query to the Uppercase letters .


Senthil Kumar B
Senthil Kumar is a former Microsoft MVP (Most Valuable Professional). He is a Co-Author of the book "Windows 10 Development Recipes using JavaScript and CSS" for Apress Publication. He is a technical presenter, blogger, mentor and a Geek.  Senthil is a regular speaker is various local user groups. He has presented at conferences like Great Indian Developer Summit (GIDS) & Microsoft DevCamps. You can reach out to him via his Twitter handle @isenthil.