viernes, 18 de junio de 2010

Llamar un stored procedure mediante Dynamics AX

static void llamaStoredProcedure(Args _args)
{
LogInProperty Lp = new LogInProperty();
OdbcConnection myConnection;
Statement myStatement;
ResultSet myResult;
;

LP.setServer("NombreSrv");
LP.setDatabase("NombreBD");

try
{
myConnection = new OdbcConnection(LP);
}
catch
{
info("Check usuario/password.");
return;
}

myStatement = myConnection.createStatement();
//stored procedure
myResult = myStatement.executeQuery('EXEC [custtablesp]');
custtablesp --- contiene la sentencia --- select * from custtable
while (myResult.next())
{
print myResult.getString(1);
}
pause;
}

Saludos