AX ODBC读取其他SQL数据库服务器数据
LoginProperty loginP= new LoginProperty(); OdbcConnection connection; Statement statement; ResultSet resultSet; ; loginP.setOther("Driver={SQL Server};Server={192.168.1.100};uid=username;pwd=userpwd"); loginP.setDatabase("CompanyS"); connection= new OdbcConnection(loginP); statement=connection.createStatement(); resultSet=statement.executeQuery("select top 200 * from InvMovements "); while(resultSet.next()) { info(resultSet.getString(1)+" "+strfmt("%1",resultSet.getDate(5))); } statement.close();
直接使用,无需设置DSN,数据库密码保存可参考系统的邮件账号的密码保存方法