zoukankan      html  css  js  c++  java
  • Delphi中操作sql代码

    一个例子:

     with QryTemp do begin
         if Active then close;
         sql.Clear;
         //    select dsjbh,qh,uphone,zjtype,uzjsj,checkflag from user_card
         sql.Text:='update user_card set checkflag=1 where'
          +' dsjbh=:dsjbh and uphone=:phone and qh=:qh';
         Parameters.ParamByName('dsjbh').Value:=dsjbh;
         Parameters.ParamByName('phone').Value:=uphone;
         Parameters.ParamByName('qh').Value:=qh;
         ExecSQL;

    另一个例子:

      with qrypx do begin
          close;//    select
          sql.Clear;
          sql.text:='select top 30 dsjbh,qh,zjtype,uphone,uzjsj,checkflag from user_card '
          +'where uzjsj>=:uzjsj and checkflag=0 order by uzjsj,uphone';
          Parameters.ParamByName('uzjsj').Value:=lastzjtime;
          open;
          if recordcount>0 then begin
            while not eof do begin
              Application.ProcessMessages();
              sleep(1);
              if(bExitFlag) then break;
              strqh:=trim(Fieldbyname('qh').AsString);
              strphone:=trim(Fieldbyname('uphone').AsString);
              strdsjbh:=trim(Fieldbyname('dsjbh').AsString);
              strZjtype:=trim(Fieldbyname('zjtype').AsString);//添加装机类型
              zjtime:=Fieldbyname('uzjsj').AsDateTime;

    第三个例子:

              try
       with QryTemp do begin
         if Active then close;
         sql.Clear;
         sql.Text:='select mkbh from haomaduan '
         +'where dsjbh='''+strdsjbh+''' and qh='''+ strqh
         + ''' and ((cast(starthao as bigint)<='+strphone+
          ')and (cast(endhao as bigint)>='+strphone+'))';
         open;
         if recordcount>0 then  result:=trim(fieldbyname('mkbh').AsString)
         else result:='-1'
       end;
     except
       result:='-1';
     end;

  • 相关阅读:
    Scikit-learn学习记录【持续更新】——Scikit-learn框架的入门介绍
    【步骤超详细】mac系统 通过anaconda配置Pycharm的scikit-learn环境
    与高哥聊天有感
    蓝杰学长学姐交流记录
    Robcup2D足球学习记录【2020.01.06】
    分治算法
    多所学校就业报告分析总结
    想要半年之内拿到30万大厂的offer?看这里!!!
    C语言变量的存储类别
    C语言函数入门
  • 原文地址:https://www.cnblogs.com/feng801/p/1274221.html
Copyright © 2011-2022 走看看