Dynamics AX 3.0 'da ODBC Select

Bir önceki makalemizin devamı olarak değerlendirebilirsiniz. Şimdi bir Select ifadesini nasıl kullanacağımızı ve dönen değeri resultSet'e atarak nasıl kullancağımıza bakalım.

Static boolean ODBCSelect()
{
str strSQL;
ODBCConnector ODBCContent; // bir önceki makalede bulunan fonksiyon bulunduğu Class
ResultSet resultSetContent;
Statement statementContent;
int contentID ;
str contentStr;
;
try {

strSQL=strfmt("SELECT * FROM Table WHERE con ='%1' ",statement,);
statementContent=ODBCConnector::newODBCConnectionStatement();
resultSetContent=statementContent.executeQuery(strSQL);
while(resultSetContent.next())
{
contentID = resultSetContent.getInt(1);
contentStr=resultSetContent.getString(2); // Alanın dönen değerdeki yeri parametre olarak verilmeli

}
resultSetContent.close();
statementContent.close();
return true;

}
catch (Exception::Error)
{
throw Exception::Error;
}
catch (Exception::Break)
{
throw Exception::Break;
}
catch (Exception::DDEerror)
{
throw Exception::DDEerror;
}
catch (Exception::Deadlock)
{
throw Exception::Error;
}
catch (Exception::Info)
{
throw Exception::Info;
}
catch (Exception::Internal)
{
throw Exception::Internal;
}
catch (Exception::Numeric)
{
throw Exception::Numeric;
}
catch (Exception::Sequence)
{
throw Exception::Sequence;
}
catch (Exception::Warning)
{
throw Exception::Warning;
}
}

Hiç yorum yok: