F
fashow
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
m,p1,p2:string;
n:Tdatetime;
begin
p1:=FormatDatetime('yyyy-MM-dd',DatetimePicker1.Date);
p2:=FormatDatetime('yyyy-MM-dd',DatetimePicker2.Date);
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='select * from Tperson [red]where ID=2006004[/red]';
ADOQuery1.Open;
ADOQuery1.First;
for i:=0 to ADOQuery1.RecordCount-1 do
begin
if not ADOQuery1.Eof then
begin
n:=ADOQuery1.fieldbyname('Pbirth').asdatetime;//运行到这里出错了
m:=FormatDatetime('yyyy-MM-dd',n);
if (m>=p1) and (m<=p2 )then
begin
ADOQuery1.Edit ;
ADOQuery1.FieldByName('Pmemo').AsString :='1';
ADOQuery1.Post;
end;
ADOQuery1.Next;
end;
end;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='select * from Tperson where Pmemo='''+'1'+'''';
ADOQuery1.Open;
var
i:integer;
m,p1,p2:string;
n:Tdatetime;
begin
p1:=FormatDatetime('yyyy-MM-dd',DatetimePicker1.Date);
p2:=FormatDatetime('yyyy-MM-dd',DatetimePicker2.Date);
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='select * from Tperson [red]where ID=2006004[/red]';
ADOQuery1.Open;
ADOQuery1.First;
for i:=0 to ADOQuery1.RecordCount-1 do
begin
if not ADOQuery1.Eof then
begin
n:=ADOQuery1.fieldbyname('Pbirth').asdatetime;//运行到这里出错了
m:=FormatDatetime('yyyy-MM-dd',n);
if (m>=p1) and (m<=p2 )then
begin
ADOQuery1.Edit ;
ADOQuery1.FieldByName('Pmemo').AsString :='1';
ADOQuery1.Post;
end;
ADOQuery1.Next;
end;
end;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='select * from Tperson where Pmemo='''+'1'+'''';
ADOQuery1.Open;