Axaptapedia is now maintained by AgileCadence For more information please click here.

Calling a stored procedure

From Axaptapedia
Revision as of 07:03, 8 June 2012 by Aj (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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