cfh := QuerySelectCfHw['cf'];
hwh := QuerySelectCfHw['hw'];
insert into PrintT2(cfm,hw) values(cfh,hwh)为什么会出错,说是在此上下问中不允许使用'cfh',此处只允许使用常量\表达市\变量,不允许使用列名.
cfh不是列名呀
hwh := QuerySelectCfHw['hw'];
insert into PrintT2(cfm,hw) values(cfh,hwh)为什么会出错,说是在此上下问中不允许使用'cfh',此处只允许使用常量\表达市\变量,不允许使用列名.
cfh不是列名呀
hwh := QuerySelectCfHw['hw'];
------------这个是delphi(其他)的语句insert into PrintT2(cfm,hw) values(cfh,hwh)
---------- 数据库脚本语言怎么能在一起执行呢
while not QuerySelectCfHw.eof do
begin
cfh := strToInt(QuerySelectCfHw['cf']);
hwh := StrToInt(QuerySelectCfHw['hw']);
with frmdm1.QZgw do
begin
Close;
SQL.Clear;
SQL.Add(format('select max(wsd) as wsd from timeT where (bz=1 or bz=2) and cf=%d and hw=%d',[cfh,hwh]));
Open;
zgwd:=strToFloat(format('%4.1f',[fields[0].asfloat]));// fields[0].asfloat;
end;
with frmdm1.QZdw do
begin
Close;
SQL.Clear;
SQL.Add(format('select min(wsd) as wsd from timeT where (bz=1 or bz=2) and cf=%d and hw=%d',[cfh,hwh]));
Open;
zdwd:=strToFloat(format('%4.1f',[fields[0].asfloat]));//fields[0].asfloat;
end;
with frmdm1.QPjw do
begin
close;
SQL.clear;
SQL.Add(format('select avg(wsd) as wsd from timeT where (bz=1 or bz=2) and cf=%d and hw=%d',[cfh,hwh]));
open;
Pjwd:=strToFloat(format('%4.1f',[fields[0].asfloat]));//fields[0].asfloat;
end; with frmdm1.QprintCS do
begin
Close;
SQL.Clear;
SQL.Add(format('select wsd from timeT where bz=13 and cf=%d',[cfh]));
Open;
csd:=strToFloat(format('%4.1f',[fields[0].asfloat]));//fields[0].asfloat;
end;
with frmdm1.QprintCW do
begin
Close;
SQL.Clear;
SQL.Add(format('select avg(wsd) as wsd from timeT where bz=3 and cf=%d',[cfh]));
Open;
cwd:=strToFloat(format('%4.1f',[fields[0].asfloat]));//fields[0].asfloat;
end;
with frmdm1.QXz do //限值
begin
close;
SQL.clear;
SQL.Add(format('select * from settingT where cf=%d and hw=%d',[cfh,hwh]));
open;
wdsxd :=strToFloat(frmDM1.QXz['wdsx']);
wdxxd := strToFloat(frmDM1.QXz['wdxx']);
sdsxd := strToFloat(frmDM1.QXz['sdsx']);
sdxxd := strToFloat(frmDM1.QXz['sdxx']);
end; with QueryGernPrint do
begin Close;
SQL.Clear;
SQL.Add('delete from PrintT2');
execsql; Close;
SQL.Clear;
SQL.Add('insert PrintT2 values(:cfh,:hwh,:pjwd,:zgwd,:zdwd,:csd,:cwd,:wdsxd,:wdxxd,:sdsxd,:sdxxd,:dtime1)');
QueryGernPrint.ParamByName('cfh').AsInteger := cfh;
QueryGernPrint.ParamByName('hwh').AsInteger := hwh;
QueryGernPrint.ParamByName('pjwd').AsFloat := pjwd;
QueryGernPrint.ParamByName('zgwd').AsFloat := zgwd;
QueryGernPrint.ParamByName('zdwd').AsFloat := zdwd;
QueryGernPrint.ParamByName('csd').AsFloat := csd;
QueryGernPrint.ParamByName('cwd').AsFloat := cwd;
QueryGernPrint.ParamByName('wdsxd').AsFloat := wdsxd;
QueryGernPrint.ParamByName('wdxxd').AsFloat := wdxxd;
QueryGernPrint.ParamByName('sdsxd').AsFloat := sdsxd;
QueryGernPrint.ParamByName('sdxxd').AsFloat := sdxxd;
QueryGernPrint.ParamByName('dtime1').AsFloat := dtime1;
execsql;
QueryGernPrint.Edit;
end;
QueryGernPrint.ApplyUpdates;
QuerySelectCfHw.Next;
end;
为什么只查了一条记录进去,大家帮我看看
QuerySelectCfHw.first;
while not QuerySelectCfHw.eof do
begin
计算或查询记录字段值;
插入一条记录;
QuerySelectCfHw.next;
end;
begin Close;
SQL.Clear;
SQL.Add('delete from PrintT2');
execsql;这里出问题了。你每次插入记录前都把表清空了。最后当然是只有一条了!