Axaptapedia is now maintained by AgileCadence For more information please click here.
Calling a stored procedure
From Axaptapedia
Here is a piece of code to execute a stored procedure thru Axapta <xpp>
static void storedProcedure(Args _args) {
LogInProperty Lp = new LogInProperty(); OdbcConnection myConnection; Statement myStatement; ResultSet myResult; ;
LP.setServer("SeverName");
LP.setDatabase("DataBaseName");
Lp.setUsername("sa");
Lp.setPassword("sa");
try
{
myConnection = new OdbcConnection(LP);
}
catch
{
info("Check username/password.");
return;
}
myStatement = myConnection.createStatement();
myResult = myStatement.executeQuery('EXEC [inventtablesp]');//stored procedure name
while (myResult.next())
{
print myResult.getString(1);
}
pause;
} </xpp>
REGARDS SREENATH REDDY