Enum value showing some garbage value


In my requirement, i am trying to make connection between 2 ax 2009 tables kept at 2 different instances, using ODBC. i have to print the differences of the records between the two same tables kept on these instances. I am executing the code at the source (while making a connection the target AX DB).

For example, To compare DirPersonPartyDetailTable in the two instances, i have performed the following:

DirPersonPartyDetailTable Table1, Table2; // variable declaration

Resultset result;


select * from table1;




for Table 2, an ODBC connection was made and eventually the data of table 2 will be retrieved in the form of a Resultset. Now i am putting field values manually, for example:

Table2.PartyId = result.getString(1);
Table2.NickName = result.getString(2);
Table2.Initials = result.getString(3);
Table2.ChildrenNames = result.getString(4); etc…

after this the code that compares the data between these 2 buffers is executed. Everything is fine and the comparision code is handling arrya types, string type and all other types of fields very well but for enum type fields, it is returning the garbage value as ‘255’ for every enum value = 0 it encounters in the source table record.

Although the value of that field is same in both the tables (at both instances) but for the target table it is fetching enum value as 255. because of this it calculates that as a difference in values of the fields and hence prints the report. whereas, the report should come out to be empty.

I hope that my concern is clear. Please provide inputs ASAP to help resolve this issue.