用了2个adoquery还是不行。还有以下语句又是什么错: no:string; begin ADOQuery2.Close; ADOQuery2.SQl.Clear; ADOQuery2.SQl.Add('select sub = SUBSTRING(交易帐号,1,6) from db where 文件名=:文件名'); ADOQuery2.Parameters.ParamByName('文件名').Value:=TheRecord; ADOQuery2.Open; ADOQuery2.First; while not ADOQuery2.Eof do begin no:=ADOQuery2.FieldByname('sub').Asstring; if no <> '605883' then begin Application.MessageBox('交易帐号非本局帐号,请核对数据文件','警告',mb_OK); end; ADOQuery2.Next; end; end;
'select SUBSTRING(交易帐号,1,6) as sub from db where 文件名=:文件名'
ADOQuery2.Close; ADOQuery2.SQL.Clear; ADOQuery2.SQL.Add('select 尾记录交易总金额 as val from dbc where 文件名=:文件名'); ADOQuery2.parameters.ParamByName('文件名').Value:=TheRecord; ADOQuery2.Open; field:=ADOQuery2.FieldByname('val').AsString; allmoney:=strtointdef(Trim(field), 0); // ~~~~~
to zswang: 改为'select SUBSTRING(交易帐号,1,6) as sub from db where 文件名=:文件名' 还是同样的错误,上面的提示是‘语法错误(操作符丢失)
no:string; begin ADOQuery2.Close; ADOQuery2.SQl.Clear; ADOQuery2.SQl.Add('select 交易帐号 from db where 文件名=:文件名'); ADOQuery2.sql.add(' and 交易帐号 not like ''605883%'''); ADOQuery2.Parameters.ParamByName('文件名').Value:=TheRecord; ADOQuery2.Open; ADOQuery2.First; no := ''; while not ADOQuery2.Eof do begin no:= no + #13#10 + ADOQuery2.FieldByname('交易帐号').Asstring; ADOQuery2.Next; end; if trim(no) <> '' then Application.MessageBox(pchar('以下交易帐号非本局帐号,请核对数据文件'+trim(no)),'警告',mb_OK);end; 另外第一个是什么错误?
no:string;
begin
ADOQuery2.Close;
ADOQuery2.SQl.Clear;
ADOQuery2.SQl.Add('select sub = SUBSTRING(交易帐号,1,6) from db where 文件名=:文件名');
ADOQuery2.Parameters.ParamByName('文件名').Value:=TheRecord;
ADOQuery2.Open;
ADOQuery2.First;
while not ADOQuery2.Eof do
begin
no:=ADOQuery2.FieldByname('sub').Asstring;
if no <> '605883' then
begin
Application.MessageBox('交易帐号非本局帐号,请核对数据文件','警告',mb_OK);
end;
ADOQuery2.Next;
end;
end;
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Add('select 尾记录交易总金额 as val from dbc where 文件名=:文件名');
ADOQuery2.parameters.ParamByName('文件名').Value:=TheRecord;
ADOQuery2.Open;
field:=ADOQuery2.FieldByname('val').AsString;
allmoney:=strtointdef(Trim(field), 0);
// ~~~~~
改为'select SUBSTRING(交易帐号,1,6) as sub from db where 文件名=:文件名'
还是同样的错误,上面的提示是‘语法错误(操作符丢失)
begin
ADOQuery2.Close;
ADOQuery2.SQl.Clear;
ADOQuery2.SQl.Add('select 交易帐号 from db where 文件名=:文件名');
ADOQuery2.sql.add(' and 交易帐号 not like ''605883%''');
ADOQuery2.Parameters.ParamByName('文件名').Value:=TheRecord;
ADOQuery2.Open;
ADOQuery2.First;
no := '';
while not ADOQuery2.Eof do
begin
no:= no + #13#10 + ADOQuery2.FieldByname('交易帐号').Asstring;
ADOQuery2.Next;
end;
if trim(no) <> '' then Application.MessageBox(pchar('以下交易帐号非本局帐号,请核对数据文件'+trim(no)),'警告',mb_OK);end;
另外第一个是什么错误?
在access中将字符型转换成数值型的类型转换函数是什么?