|
procedure TINFORMATIONSTATFORM.Button1Click(Sender: TObject);
var
lDBURL,lStr1,lStr2 : String;
lBeginDate,lEndDate : Tdatetime;
lInt : Integer;
lQuery: TQuery;
begin
lInt := SysUtils.strtoint(ComboBox1.Text);
lStr1:= ComboBox1.Text+'-'+ComboBox2.Text+'-01';
if (ComboBox2.Text='01' ) or (ComboBox2.Text='03' ) or (ComboBox2.Text='05') or (ComboBox2.Text='07') or (ComboBox2.Text='08') or (ComboBox2.Text='10') or (ComboBox2.Text='12') then
lStr2:= ComboBox1.Text+'-'+ComboBox2.Text+'-31';
if (ComboBox2.Text='04') or (ComboBox2.Text='06') or (ComboBox2.Text='09') or (ComboBox2.Text='11') then
lStr2:= ComboBox1.Text+'-'+ComboBox2.Text+'-30';
if ComboBox2.Text='02' then
begin
if (lInt mod 4=0 and lInt mod 100<>0) or (lInt mod 400 = 0) then
lStr2:= ComboBox1.Text+'-'+ComboBox2.Text+'-29';
lStr2:= ComboBox1.Text+'-'+ComboBox2.Text+'-28';
end;
lBeginDate := SysUtils.strtodate(lStr1);
lEndDate := SysUtils.strtodate(lStr2);
lDBURL:='DATABASEURL=Biz:HGOPERATIONHGOPERATIONDB.DATABASE';
lQuery.ConnectionString := lDBURL;
lQuery.CommandText :=
' SELECT QualitydefectGrade AS Grade, COUNT(QualitydefectGrade) AS Count FROM NCINFOTABLE where '+
' DeptAuditDate >= lBeginDate and ' +
' DeptAuditDate <= lEndDate ' +
' GROUP BY QualitydefectGrade ';
while not lQuery.Eof do
begin
JsDialogs.ConfirmBox(lQuery.FieldByName('Grade').AsString,'提示信息',1 ) ;
lQuery.next;
end;
end;
这段注释掉就正常了
{lDBURL:='DATABASEURL=Biz:HGOPERATIONHGOPERATIONDB.DATABASE';
lQuery.ConnectionString := lDBURL;
lQuery.CommandText :=
' SELECT QualitydefectGrade AS Grade, COUNT(QualitydefectGrade) AS Count FROM NCINFOTABLE where '+
' DeptAuditDate >= lBeginDate and ' +
' DeptAuditDate <= lEndDate ' +
' GROUP BY QualitydefectGrade ';
while not lQuery.Eof do
begin
JsDialogs.ConfirmBox(lQuery.FieldByName('Grade').AsString,'提示信息',1 ;
lQuery.next;
end; }
Biz:HGOPERATIONHGOPERATIONDB.DATABASE 这个数据连接是没有问题的 因为其他模块也在使用这个链接的
|
-
-
a.jpg
221.97 KB, 下载次数: 90
|