注册 登录
编程论坛 Delphi论坛

如何获取打印按钮的打印次数???

scindy 发布于 2008-03-13 14:40, 1076 次点击
我想获取一个窗口中的打印次数,不知道该如何实现,下面的程序提示"无法编译",大家帮我看一下~~~,ps是一个计数器,获取后再写到数据库里~``
procedure MyBeforePrint(ModID: Integer);
var
  mr: TModalResult;
  Flag: string;
  PS: Integer;
begin
  Flag := me.cdsMain.FieldByName('ParentXSKPNo').AsString;
  PS := 0;
  Repeat
   PS := PS+1;
   DirectExecuteSQL(GlobalConfig.DB.DBName, 'UPDATE tblXSKPMain SET PrintCount=ps WHERE XSKPNo='+
      AnsiQuotedStr(Me.cdsMain.FieldByName(Me.ReceiptNoCol).AsString, SQLQUOTEDCHAR));
  IF Flag = 'Y'then
  begin
    mr := MessageDlg('此单据之前已经打印,继续打印吗?', mtConfirmation, [mbYes, mbNo], 0);
    if mr = mrNo then Abort;
  end;
  Until PS=5;
  if Me.cdsMain.FieldByName('ParentXSKPNo').AsString <> 'Y' then
    DirectExecuteSQL(GlobalConfig.DB.DBName, 'UPDATE tblXSKPMain SET ParentXSKPNo=''Y'' WHERE XSKPNo='+
      AnsiQuotedStr(Me.cdsMain.FieldByName(Me.ReceiptNoCol).AsString, SQLQUOTEDCHAR));
end;
1 回复
#2
scindy2008-03-13 14:41
另外补充一下:
DirectExecuteSQL(GlobalConfig.DB.DBName, 'UPDATE tblXSKPMain SET PrintCount=ps WHERE XSKPNo='+
      AnsiQuotedStr(Me.cdsMain.FieldByName(Me.ReceiptNoCol).AsString, SQLQUOTEDCHAR));
这句代码改成
DirectExecuteSQL(GlobalConfig.DB.DBName, 'UPDATE tblXSKPMain SET PrintCount=' + ps + 'WHERE XSKPNo='+
      AnsiQuotedStr(Me.cdsMain.FieldByName(Me.ReceiptNoCol).AsString, SQLQUOTEDCHAR));

也不行,怎么实现把这个ps加到语句里呢~???
1