Dynamics AX 3.0 'da ODBC Connection

Bu makalemizde Axapta'da ODBC kullanarak SQL veritabanına nasıl erişeceğimize ait örnekleri görebilirsiniz.
Axaptada ODBC ayarlarını yapmak ve SQL üzerinde işlem yapmak son derece kolaydır.
İlk olarak bir ODBC kullanarak SQL'e nasıl login olacağımıza bakalım. Aşağadaki örnekte görebileceğiniz gibi ODBCConnection ve loginProperty isimli 2sınıf (Classes) kullanılmış. Login olunacak server bilgileri LoginProperty ile tanımlandıktan sonra. Yeni bir ODBCConnection statement 'ı oluştrulur.
diğer örneklerde kullanmak açısından, bu fonksyonun oluşturacağımız ODBCConnector isimli bir classes'da kullanabilirsiniz.

Static Statement newODBCConnectionStatement()
{
ODBCConnection oDBCConnection;
LoginProperty loginProperty;
Statement statement;
;
try
{
loginProperty = new LoginProperty();
loginProperty.setServer("SQLServer");
loginProperty.setDatabase("Database");
loginProperty.setUsername("UserName");
loginProperty.setPassword("UserPassword");

oDBCConnection = new ODBCConnection(loginProperty);
statement = oDBCConnection.createStatement();
Return statement;

}
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: