To execute query in axapta you can try following code
QueryRun QR;
TestTableTestTable;
;
QR = new QueryRun(QueryStr(QR));
if (QR.prompt())
{
while (QR.next())
{
if (QR.changed(tablenum(TestTable)))
{
TestTable = QR.get(
tablenum(TestTable));
info(TestTable.TestId);
}
}
}