码迷,mamicode.com
首页 > 数据库 > 详细

ADO SQL delete 日期条件参数

时间:2015-05-16 00:09:16      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, ADODB, Grids, DBGrids;

type
  TForm1 = class(TForm)
    Button1: TButton;
    ADOQuery1: TADOQuery;
    Memo1: TMemo;
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

var
  tfdate: string;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
const
  FROMWhereStr =  from tbtest WHERE tfDate=:tfDate;
  ParamBuyDateTime = tfDate;
begin
  ADOQuery1.SQL.Text := select *  + FROMWhereStr ;
  ADOQuery1.Parameters.ParamByName(ParamBuyDateTime).Value := 2015-05-15 20:34:00;
  ADOQuery1.Open;
  Memo1.Lines.Add( ADOQuery1.Parameters.ParamByName(ParamBuyDateTime).Value +   +  IntToStr(ADOQuery1.RecordCount));
end;

procedure TForm1.Button2Click(Sender: TObject);
const
  FROMWhereStr =  from tbtest WHERE tfDate < #2015-05-15 20:34:00#;
  ParamBuyDateTime = tfDate;
begin
  ADOQuery1.SQL.Text := select *  + FROMWhereStr ;
  ADOQuery1.Open;
  Memo1.Lines.Add( ADOQuery1.SQL.Text +   +  IntToStr(ADOQuery1.RecordCount));
end;


end.

 

ADO SQL delete 日期条件参数

标签:

原文地址:http://www.cnblogs.com/CodeGear/p/4506987.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!