Y
yedixifeng
Unregistered / Unconfirmed
GUEST, unregistred user!
下面这段是完成一项查询
procedure Tkc_form.RadioButton1Click(Sender: TObject);
begin
with database do
begin
//showmessage('为保证数据的最新,请先导入库存信息!');
adoq1.Connection := adoc;
adoq4.Connection := adoc;
adoq1.SQL.Clear;
edit8.Text := formatdatetime('MM-dd-yy', datetimepicker1.date);
edit9.Text := formatdatetime('MM-dd-yy', datetimepicker2.date);
adoq1.SQL.Add(' select 类别,商品编码,商品名称,规格,型号,单位,sum(库存数量) as 现有库存数量,sum(库存金额) as 现有库存
金额 from kcb where 录单日期 between #' + edit8.text + '# and #' + edit9.text + '# group by 类别,商品编码,商品名称,规格,
型号,单位');
adoq1.Active := true;
if adoq1.Recordset.RecordCount > 0 then
begin
adoq4.SQL.Clear;
adoq4.SQL.Add('select sum(库存数量) as sl,sum(库存金额) as je1 from kcb where 录单日期 between #' + edit8.text + '# and
#' + edit8.text + '#');
adoq4.Active := true;
statusbar1.Panels[1].Text := inttostr(adoq1.Recordset.RecordCount);
statusbar1.Panels[3].Text := floattostr(adoq4.Fields.Fields[0].AsFloat);
statusbar1.Panels[5].Text := floattostr(adoq4.Fields.Fields[1].AsFloat);
datas1.DataSet := adoq1;
dbgrid1.DataSource := datas1;
dbgrid1.Columns[0].Width := 70;
dbgrid1.Columns[1].Width := 70;
dbgrid1.Columns[2].Width := 70;
dbgrid1.Columns[3].Width := 70;
dbgrid1.Columns[4].Width := 70;
dbgrid1.Columns[5].Width := 80;
dbgrid1.Columns[6].Width := 80;
end
else
showmessage('库中无信息,请先导入!');
end;
end;
现在在做的,增加一个edit10.text,输入的是仓库名称,如 输入的是仓库一,查询时完成仓库一的列表,输入的是仓库二,查询时完成仓库二的列表,等等。
请教,如何修改上述的代码?
procedure Tkc_form.RadioButton1Click(Sender: TObject);
begin
with database do
begin
//showmessage('为保证数据的最新,请先导入库存信息!');
adoq1.Connection := adoc;
adoq4.Connection := adoc;
adoq1.SQL.Clear;
edit8.Text := formatdatetime('MM-dd-yy', datetimepicker1.date);
edit9.Text := formatdatetime('MM-dd-yy', datetimepicker2.date);
adoq1.SQL.Add(' select 类别,商品编码,商品名称,规格,型号,单位,sum(库存数量) as 现有库存数量,sum(库存金额) as 现有库存
金额 from kcb where 录单日期 between #' + edit8.text + '# and #' + edit9.text + '# group by 类别,商品编码,商品名称,规格,
型号,单位');
adoq1.Active := true;
if adoq1.Recordset.RecordCount > 0 then
begin
adoq4.SQL.Clear;
adoq4.SQL.Add('select sum(库存数量) as sl,sum(库存金额) as je1 from kcb where 录单日期 between #' + edit8.text + '# and
#' + edit8.text + '#');
adoq4.Active := true;
statusbar1.Panels[1].Text := inttostr(adoq1.Recordset.RecordCount);
statusbar1.Panels[3].Text := floattostr(adoq4.Fields.Fields[0].AsFloat);
statusbar1.Panels[5].Text := floattostr(adoq4.Fields.Fields[1].AsFloat);
datas1.DataSet := adoq1;
dbgrid1.DataSource := datas1;
dbgrid1.Columns[0].Width := 70;
dbgrid1.Columns[1].Width := 70;
dbgrid1.Columns[2].Width := 70;
dbgrid1.Columns[3].Width := 70;
dbgrid1.Columns[4].Width := 70;
dbgrid1.Columns[5].Width := 80;
dbgrid1.Columns[6].Width := 80;
end
else
showmessage('库中无信息,请先导入!');
end;
end;
现在在做的,增加一个edit10.text,输入的是仓库名称,如 输入的是仓库一,查询时完成仓库一的列表,输入的是仓库二,查询时完成仓库二的列表,等等。
请教,如何修改上述的代码?