Axapta: Get data from Database by SQL

百般思念 提交于 2020-03-05 08:48:43

You can copy it to a job:  

  LoginProperty           loginProperty = new LoginProperty();
    ODBCConnection      con;
    Statement                stmt;
    str                           sqlString, result;
    ResultSet                 resultSet;
    ;

    loginProperty.setServer('servername');
    loginProperty.setDatabase('DB name');
    loginProperty.setUsername('username');
    loginProperty.setPassword('pwd');
    con = new ODBCConnection(loginProperty);
    sqlString = "select * from Address"  ;
    stmt = Con.createStatement();
    resultSet = Stmt.executeQuery(sqlString);
    resultSet.next();
    result = resultSet.getString(1);
    if (result)
    {
        info(result);
    }
    else
    {
        info( "No record! " );
    }

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!