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

📄 u_data_update.pas

📁 这是一个非常使用的DELPHI源码的例子,用的是SQL数据库和DELPHI企业版
💻 PAS
字号:
unit U_Data_Update;

interface
{1}
Procedure SQl_Exec(Sql:string);//sql执行语句
{2}
Function Num_Return(sql:string;Bm:string):string;//编号返回
{3}
procedure Data_ini();

implementation
uses u_data,sysutils,StrUtils,u_public_define;
{1 }
procedure sql_exec(sql:string);
  begin
      data.G_con.Open();
      data.G_Rst1.SQL.Clear;
      data.G_Rst1.SQL.Add(sql);
      data.G_Rst1.ExecSQL;
  end;
 {2}  //本函数只执行两个表,一个是mr_jbb,一个是mr_people
 function Num_return(Sql:string;Bm:string):string;
  var Bh:string;
      i:integer;
  begin
    data.G_con.Open();
    data.G_Rst_use.SQL.Clear;
    data.G_Rst_use.SQL.Add(sql);

    data.G_Rst_use.ExecSQL;
    data.g_rst_use.open;
   if bm='mr_people' then
     begin
       bh:='Ry'+'000001';
       while not data.G_Rst_use.Eof do
         begin
            bh:=data.G_Rst_use.FieldValues['bh'];
            bh:=inttostr(strtoint(midstr(bh,4,6))+1);

             data.G_Rst_use.Next;
         end;
         i:=length(bh);
         if i<10 then
          begin
           bh:='Ry'+'00000'+bh;
          end
         else if i<100 then
           begin
           bh:='Ry'+'0000'+bh;
          end
         else if i<1000 then
           begin
           bh:='Ry'+'000'+bh;
          end;
     end
   else if bm='mr_khgl' then
      begin
          bh:='Mr'+formatdatetime('yyyy',now)+'-000001';
       while not data.G_Rst_use.Eof do
         begin
            bh:=data.G_Rst_use.FieldValues['kh'];
            bh:=inttostr(strtoint(midstr(bh,8,6))+1);

             data.G_Rst_use.Next;
         end;
         i:=length(bh);
         if i<10 then
          begin
           bh:='Mr'+formatdatetime('yyyy',now)+'-00000'+bh;
          end
         else if i<100 then
           begin
           bh:='Mr'+formatdatetime('yyyy',now)+'-0000'+bh;
          end
         else if i<1000 then
           begin
           bh:='Mr'+formatdatetime('yyyy',now)+'-000'+bh;
          end;
       end
   else if  bm='mr_jbb' then
         begin
         bh:='0001';
       while not data.G_Rst_use.Eof do
         begin
            bh:=data.G_Rst_use.FieldValues['m_bh'];
            bh:=inttostr(strtoint(bh)+1);

             data.G_Rst_use.Next;
         end;
         i:=length(bh);
         if i<10 then
          begin
           bh:='000'+bh;
          end
         else if i<100 then
           begin
           bh:='00'+bh;
          end
         else if i<1000 then
           begin
           bh:='0'+bh;
          end;

     end
   else
     begin
         bh:='0001';
       while not data.G_Rst_use.Eof do
         begin
            bh:=data.G_Rst_use.FieldValues['kh'];
            bh:=inttostr(strtoint(bh)+1);

             data.G_Rst_use.Next;
         end;
         i:=length(bh);
         if i<10 then
          begin
           bh:='000'+bh;
          end
         else if i<100 then
           begin
           bh:='00'+bh;
          end
         else if i<1000 then
           begin
           bh:='0'+bh;
          end;

     end;
       num_return:=bh;
  end;
 procedure Data_ini();
  begin
  //
    with data do
      begin
          g_con.Open();
          g_rst_temp1.SQL.Clear;
          g_Rst_temp1.SQL.Add('select * from mr_gjb');
          g_Rst_temp1.ExecSQL;
          g_Rst_temp1.Open;

     G_Gj_Ckh:=strtoint(trim(g_Rst_temp1.FieldValues['dkqh']));//串口号
      G_Gj_Ckys:=strtoint(trim(g_Rst_temp1.FieldValues['ckts']));//串口延时
      G_Gj_Zdjh:=strtoint(trim(g_Rst_temp1.FieldValues['zdjh']));//最大机号
      G_Gj_KxzhYj:=strtofloat(trim(g_Rst_temp1.FieldValues['khyj'])); //开新账户押金
      G_Gj_HkGdFy:=strtofloat(trim(g_Rst_temp1.FieldValues['hkgdfy']));  //换卡固定费用
      G_Gj_RxfLjXe:=strtofloat(trim(g_Rst_temp1.FieldValues['rxfxe']));//日消费累计限额
      G_Gj_RxfljXc:=strtofloat(trim(g_Rst_temp1.FieldValues['dkqh'])); //日消费累计限次
      G_GJ_BoolBf:=g_Rst_temp1.FieldValues['tbf'];  //退出系统时备份
      G_Gj_BoolJhkz:=g_Rst_temp1.FieldValues['jhkz']; //进行机号控制
      G_Gj_BoolXe:=g_Rst_temp1.FieldValues['xfxc'];  //进行限额控制
      G_Gj_BoolXc:=g_Rst_temp1.FieldValues['xfxe']; //进行限次控制
      end;
    {
    G_Gj_Ckh:integer;//串口号
    G_Gj_Ckys:integer;//串口延时
    G_Gj_Zdjh:integer;//最大延时
    G_Gj_KxzhYj:real; //开新账户押金
    G_Gj_HkGdFy:Real;  //换卡固定费用
    G_Gj_RxfLjXe:real;//日消费累计限额
    G_Gj_RxfljXc:real; //日消费累计限次
    G_GJ_BoolBf:boolean;  //退出系统时备份
    G_Gj_BoolJhkz:boolean; //进行机号控制
    G_Gj_BoolXe:boolean;  //进行限额控制
    G_Gj_BoolXc:boolean; //进行限次控制
   }
  end;
end.

⌨️ 快捷键说明

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