program Databaseprj;
uses
Forms,
DBtest
in '
DBtest.pas'
{Form2};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm2, Form2);
Application.Run;
end.
unit DBtest;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ADODB, Grids, DBGrids,
DB, StdCtrls;
type
TForm2 =
class(TForm)
ADOConnection1: TADOConnection;
ADODataSet1: TADODataSet;
DataSource1: TDataSource;
DBGrid_SQL_Result: TDBGrid;
btn_Query: TButton;
Edt_SQL_Input: TEdit;
procedure btn_QueryClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.btn_QueryClick(Sender: TObject);
begin
{showmessage('test');}
ADODataSet1.active:=false;
ADODataSet1.CommandText:=Edt_SQL_Input.Text;
ADODataSet1.active:=true;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
Edt_SQL_Input.Text:='
select * from ';
end;
end.