unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, ExtCtrls, DBCtrls, Grids, DBGrids, StdCtrls;
type
TForm1 = class(TForm)
DataSource1: TDataSource;
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
ADOQuery1.Open;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from clientinfo');
ADOQuery1.SQL.Add('where buydate>:date1');
ADOQuery1.SQL.Add('and buydate<:date2');
ADOQuery1.Parameters.ParamByName('date1').Value:=strtodate(edit1.Text);
ADOQuery1.Parameters.ParamByName('date2').Value:=strtodate(edit2.Text);
ADOQuery1.Open;
end;
end.
谢谢各位。已通过。