asql:='insert into 工资表(编号,姓名,日工资,出勤天数,奖金,安装费,工资年度,工资月份) ' +'select distinct 序号,姓名,日工资,25,0,0,'+se_year.Text+','+se_month.text+' from 人员信息表.db''; 各位大虾看以上的程序那里有错,要加values吗?
asql:='insert into 工资表(编号,姓名,日工资,出勤天数,奖金,安装费,工资年度,工资月份) ' +'select distinct 序号,姓名,日工资 ,25,0,0,'+se_year.Text+','+se_month.text+' from 人员信息表.db''; 各位大虾看以上的程序那里有错,要加values吗?
不用values,不过.db是什么东东? 另外,最后好像多了个单引号
.db指的人员信息表,我在次核实多了两个单引号。出现的提示信息是‘Type mismatch in expression’,怎么处理呢?请教
要加values 并且后面要有();不用加.db
var temp,asql:string; i:integer;date1,date2:tdatetime; begin table1.Filter:='工资年度='+se_year.Text +' and 工资月份='+se_month.Text ; table1.Filtered:=true; if table1.RecordCount=0 then begin temp:='select distinct 序号,姓名,日工资,25,0,0,'+se_year.Text+','+se_month.text+' from 人员信息表.db'; asql:='insert into 工资表(编号,姓名,日工资,出勤天数,奖金,安装费,工资年度,工资月份) ' + ' select distinct 序号,姓名,日工资,25,0,0,'+se_year.Text+','+se_month.text+' from 人员信息表.db;'; query1.SQL.Text :=asql; query1.ExecSQL; table1.Refresh; table1.First; for i:=0 to table1.recordcount-1 do begin query1.Close; query1.sql.Text:='select sum(安装费) from 安装记录表.db where 主安装人=''' +table1.Fields[1].AsString+''''+' and 安装日期>=:d1 and 安装日期<:d2'; date1:=encodedate(se_year.Value,se_month.Value ,1); date2:=encodedate(se_year.Value,se_month.Value+1,1); query1.ParamByName('d1').AsDateTime:=date1; query1.ParamByName('d2').AsDateTime:=date2; query1.Open; 各位大虾,就是上面的,请教错在哪?
,25,0,0,'+se_year.Text+','+se_month.text+' from 人员信息表.db'';
各位大虾看以上的程序那里有错,要加values吗?
另外,最后好像多了个单引号
temp,asql:string;
i:integer;date1,date2:tdatetime;
begin
table1.Filter:='工资年度='+se_year.Text +' and 工资月份='+se_month.Text ;
table1.Filtered:=true;
if table1.RecordCount=0 then
begin
temp:='select distinct 序号,姓名,日工资,25,0,0,'+se_year.Text+','+se_month.text+' from 人员信息表.db';
asql:='insert into 工资表(编号,姓名,日工资,出勤天数,奖金,安装费,工资年度,工资月份) ' +
' select distinct 序号,姓名,日工资,25,0,0,'+se_year.Text+','+se_month.text+' from 人员信息表.db;';
query1.SQL.Text :=asql;
query1.ExecSQL;
table1.Refresh;
table1.First; for i:=0 to table1.recordcount-1 do
begin
query1.Close;
query1.sql.Text:='select sum(安装费) from 安装记录表.db where 主安装人='''
+table1.Fields[1].AsString+''''+' and 安装日期>=:d1 and 安装日期<:d2'; date1:=encodedate(se_year.Value,se_month.Value ,1);
date2:=encodedate(se_year.Value,se_month.Value+1,1);
query1.ParamByName('d1').AsDateTime:=date1;
query1.ParamByName('d2').AsDateTime:=date2;
query1.Open;
各位大虾,就是上面的,请教错在哪?