⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 u_ifdisk.~pas

📁 报纸接运程序,对报纸分捆,打印,查询等,适用于各种报社
💻 ~PAS
字号:
unit U_iFdisk;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ComCtrls;

type
  TF_iFdisk = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Edit1: TEdit;
    BB_c: TBitBtn;
    BB_ok: TBitBtn;
    OpenDialog1: TOpenDialog;
    BitBtn1: TBitBtn;
    ProgressBar1: TProgressBar;
    procedure BB_okClick(Sender: TObject);
    procedure BB_cClick(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  F_iFdisk: TF_iFdisk;

implementation
uses dbobj;

{$R *.dfm}

procedure TF_iFdisk.BB_okClick(Sender: TObject);
var inputfile,recordcountfile:TextFile;
     oneLine,recordcount:string;
     jhstr,zfsstr,sqlstr:string;
     m,n:integer;
begin
     Assignfile(inputfile,Edit1.Text);
     Assignfile(recordcountfile,Edit1.Text);
     //if (fileExists(Edit1.Text)) and (copy(EDit1.Text,2,10)=':\post.txt') then
     if (fileExists(Edit1.Text)) and (copy(EDit1.Text,1,16)='C:\zs_paper\post') then
     begin
        Reset(inputfile);
        Reset(recordcountfile);
        m:=0;
        n:=1;
        while not Eof(recordcountfile) do
        begin
                m:=m+1;
                readln(recordcountfile,recordcount);
        end;
       // showmessage('请稍后正在倒入磁盘数据........');
        while not Eof(inputfile) do
        begin
                Readln(inputfile,oneLine);
                jhstr:=trim(copy(oneline,1,7));
                zfsstr:=trim(copy(oneline,pos('|',oneline)+1,10));
                sqlstr:='update xqzlb  set xqzfs='''+trim(zfsstr)+''' where jh='''+trim(jhstr)+'''';
                with DataModule1.ADOConnection1 do
                begin
                Connected:=false;
                try
                        Connected:=true;
                        Execute(sqlstr);
                        if errors.Count > 0 then
                        begin
                                Connected:=false;
                                application.MessageBox('数据库访问错误,刚才提交的数据操作失败','错误提示',mb_ok);
                                exit;
                        end
                        else
                        begin
                                Connected:=false;
                        end;
                except
                        close;
                        application.MessageBox('数据库访问错误,刚才提交的数据操作失败','错误提示',mb_ok);
                        exit;
                end;
                end;
                n:=n+1;
                progressbar1.Position:=100*n div m;
        end;
        showmessage('磁盘数据导入成功........');
        closeFile(inputfile);
        closeFile(recordcountfile);
     end
     
     else
     begin
       //showmessage('please result input path and file name');
       showmessage('请正确输入文件路径及文件名');
       Edit1.SetFocus;
     end;
end;

procedure TF_iFdisk.BB_cClick(Sender: TObject);
begin
        close;
end;

procedure TF_iFdisk.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
        if key=char(13) then
             BB_ok.SetFocus;
end;

procedure TF_iFdisk.BitBtn1Click(Sender: TObject);
begin
        opendialog1.Execute;
        Edit1.Text:=opendialog1.FileName;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -