2,497
社区成员
发帖
与我相关
我的任务
分享
//更新排班主数据
iRow:=1; //初始位置,第1行
iCol:=1; //初始位置,第1列
iC:=0; //按列循环标记
while trim(msExcel.WorkSheets['sheet1'].Cells[iRow,iCol+1+iC].value) <> '' do //这句是判断日期那一列是否有内容
begin
iR:=0; //按行循环标记
while trim(msExcel.WorkSheets['sheet1'].Cells[iRow+iR,iCol].value) <> '' do //判断这行有没有数据
begin
Application.ProcessMessages;//防止进程阻塞
with query.Close;
query.SQL.Text := 'update wh_dict set wh_amount=:wh_ amount where wh_id= :wh_id and wh_name=:wh_name and in_date=:duty_date ;
Parameters.ParamByName('wh_id').Value := Trim(msExcel.WorkSheets[1].Cells[iRow+iR,iCol+iC].value);
Parameters.ParamByName('wh_name').Value := Trim(msExcel.WorkSheets[1].Cells[iRow+iR,iCol+1+iC].value);
Parameters.ParamByName('wh_amount').Value := Trim(msExcel.WorkSheets[1].Cells[iRow+iR,iCol+2+iC].value);
Parameters.ParamByName('duty_date').Value := Trim(msExcel.WorkSheets[1].Cells[iRow,iCol+1+iC].value);
ExecSQL;
end;
iR := iR + 1;
end;
iC := iC + 1;
end;
while trim(msExcel.WorkSheets['sheet1'].Cells[iCol,eicol].value) <> '' do
begin
with query.Close;
query.SQL.Text := 'update wh_dict set wh_amount=:wh_ amount where wh_id= :wh_id and wh_name:=wh_name and in_date:=in_date ;
Parameters.ParamByName('wh_id').Value := Trim(msExcel.WorkSheets[1].Cells[iRow,iCol].value);
Parameters.ParamByName('wh_name').Value := Trim(msExcel.WorkSheets[1].Cells[iRow,iCol+1].value);
Parameters.ParamByName(' wh_amount').Value := Trim(msExcel.WorkSheets[1].Cells[iRow,iCol+2].value);
Parameters.ParamByName('duty_date').Value := Trim(msExcel.WorkSheets[1].Cells[i,iCol+2].value);
ExecSQL;
with query.Close;
query.SQL.Text := 'update wh_dict set wh_amount=:wh_ amount where wh_id= :wh_id and wh_name:=wh_name and in_date:=in_date ;
Parameters.ParamByName('wh_id').Value := Trim(msExcel.WorkSheets[1].Cells[iRow,iCol].value);
Parameters.ParamByName('wh_name').Value := Trim(msExcel.WorkSheets[1].Cells[iRow,iCol+1].value);
Parameters.ParamByName(' wh_amount').Value := Trim(msExcel.WorkSheets[1].Cells[iRow,iCol+3].value);
Parameters.ParamByName('duty_date').Value := Trim(msExcel.WorkSheets[1].Cells[i,iCol+3].value);
ExecSQL;
end;
iRow:=iRow+1;
end;