zoukankan      html  css  js  c++  java
  • 线程thread,ODBC直接连接SQL

    static void Update(thread t)

    {

        CCADOConnection                 connection;

        str                             strSQL;

        CCADOCommand                    Command;

        CCADORecordSet                  RSet;

        InventTable                     it;

        SysOperationProgress            simpleProgress;

        int i,RecCount;

        ;

        connection = new CCADOConnection();

        Command = new CCADOCommand();

        RSet = new CCADORecordSet();

        connection.open("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DEV;Data Source=EKT-TS10");

        Command.activeConnection(connection);

        strSQL = "select count(*) as RecCount from InvenTtable";

        Command.commandText(strSQL);

        RSet = Command.execute();

        RecCount = RSet.fields().itemName("RecCount").value();

       strSQL = "Select top 1000 ItemId,NJ_MaterialType from InventTable";

        Command.commandText(strSQL);

        RSet = Command.execute();

        While (!RSet.EOF())

        {

            ttsbegin;

            select forupdate it where it.ItemId == RSet.fields().itemName("ItemId").value();

                it.NJ_MaterialType = RSet.fields().itemName("NJ_MaterialType").value();

                it.update();

            ttscommit;

            RSet.recordSet().movenext();

            if(i mod 100 ==0)

                print strfmt("Task: %1/%2", i,RecCount);

            i++;

        }

        RSet.close();

        connection.close();

    }

    //-------------------------------------------

    static client void main(args args)

    {

        Thread  t;

        ;

        new ExecutePermission().assert(); 

        NJ_MF_UpdateFromUAT_Thread::ShowProgressBar();

        t = new thread();

        t.run(classnum(NJ_MF_UpdateFromUAT_Thread),identifierstr(Update));

        t.removeOnComplete(true);   

    }

  • 相关阅读:
    博客园设置简约主题
    day25-48
    day1-10
    drf app
    flask 框架 练习
    vue入门 显示数据 操作属性 操作样式 条件渲染
    flask 配置文件 路由 视图 模板 中间件
    flask 使用数据库连接池
    Android 工程中添加依赖
    apk反编译
  • 原文地址:https://www.cnblogs.com/perock/p/2133336.html
Copyright © 2011-2022 走看看