C
cf83325
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.FormCreate(Sender: TObject);<br>var<br> TimeIni :TIniFile;<br> FilePath :string;<br> CountID,i,j:Integer;<br> Date1,date2,date3:TDateTime;<br>begin<br> // CountID:=0;<br> i:=0;<br> FilePath :=ExtractFilePath(ParamStr(0))+'ini/SetTime.ini';<br> TimeIni:=TIniFile.Create(FilePath);<br><br> Date1:=TimeIni.ReadDateTime('记录时间','今天',Date);<br> date2:=TimeIni.ReadDateTime('记录时间','今天',Date-1);<br> date3:=TimeIni.ReadDateTime('记录时间','今天',Date-2);<br><br><br> KeepTime;<br><br> with qry1 do<br> begin<br> Close;<br> SQL.Clear;<br> SQL.Add('select * from INVSYSL');<br> SQL.Add('where DTTR70 like '''+datetimetostr(Date1)+'%''');<br> Open;<br> end;<br><br> with qry2 do<br> begin<br> Close;<br> SQL.Clear;<br> SQL.Add('select * from INVSYSL');<br> SQL.Add('where DTTR70 like '''+datetimetostr(Date2)+'%''');<br> Open;<br> end;<br><br> with qry3 do<br> begin<br> Close;<br> SQL.Clear;<br> SQL.Add('select * from INVSYSL');<br> SQL.Add('where DTTR70 like '''+datetimetostr(Date3)+'%''');<br> Open;<br> end;<br><br> CountID:= (qry1.RecordCount-1) + (qry2.RecordCount-1) + (qry3.RecordCount-1);<br><br> lbl1.Caption:='记录数为:'+inttostr(CountID)+'条'+' ';<br><br><br> with ADOQuery1 do<br> begin<br> Close;<br> SQL.Clear;<br> SQL.Add('select top ''CountID'' * from INVSYSL');//问题就在这里,出错啦<br> Open;<br> end;<br>end;