X++ to connect the database in AX 2009

Void DBConnection()
{
LoginProperty LP = new LoginProperty();
OdbcConnection myConnection;
Statement myStatement;
ResultSet myResult;
#define.Constring("DSN=DSNName;UID=Username;PWD= ****")

;

LP.setOther(#Constring); //New line added by ramesh
myConnection = new OdbcConnection(LP);
myStatement = myConnection.createStatement();
myResult=myStatement.executeQuery("SELECT * from tablename");

while (myResult.next())
{

Name = any2str(myResult.getString(1));
Id = any2str(myresult.getString(2));
Date = any2date(myresult.getString(3));
}
}

No comments:

Post a Comment

D365 F&O Management Reporter Troubleshoot issues opening Report Designer

  Issue 1 - Report Designer doesn't start when you select "New" or "Edit" Resolution Check the Event Viewer:   If th...