Sunday, March 6, 2016

SQL ODBC Connection to another DB

//SQL ODBC Connection to another DB
static void SQLODBCConnection(Args _args)
{
    OdbcConnection con;
    SqlSystem       sq;
    LoginProperty   loginProperty;
    Statement statement1;
    ResultSet myResult1;
    str sqlStmnt;
    SqlStatementExecutePermission perm;
    sq = new SqlSystem();
    loginProperty = new LoginProperty();
    loginProperty.setServer("AOSSERVER");
    loginProperty.setDatabase("MicrosoftDynamicsAX");
    con = new OdbcConnection(loginProperty);
    sqlStmnt = strFmt("select * from Fcc_BankChequeMenus"); //write your query here
    statement1 = con.createStatement();
    perm = new SqlStatementExecutePermission(sqlStmnt);
    perm.assert();
    myResult1  = statement1.executeQuery(sqlStmnt);
    while(myResult1.next())
    {
        info(myResult1.getString(4));
        info(myResult1.getString(5));
        info(myResult1.getString(6));
        info(myResult1.getString(7));
    }
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...