In
First, create a user interface like picture shown below :
Set the properties of the components
DataSource1
DataSet | Query1 |
Button1
Caption | &G O |
DBGrid1
DataSource | DataSource1 |
Query1
DatabaseName | ALIASMYDATA |
SQL | select * from employee where age >=30 |
You have to type the SQL code in the String List editor of Query component, see the picture below :
Type the code below for the OnClick event of the GO button :
procedure TForm1.Button1Click(Sender: TObject);
begin
Query1.Open;
end;
What is the meaning of Query1.Open ?
This statement activate the Query and execute the SQL statement in SQL property of Query1. The result is like the picture shown below :
You can also add an exit button into the user interface above.
Go to Previous Tutorial or Next Tutorial
0 comments:
Post a Comment