Hi All,
There is a method named orig() in AX which refers to the last saved state of the current table buffer. The SalesTable form uses orig() method in lot of places in its datasource methods.You could find the code in the write method of the SalesTable datasource.
In the SalesLine DataSource under the SalesQty field you could find the following code in the modified() method.
if (salesLine.orig().SalesPrice!= salesLine.SalesPrice)
{
//some code here
}
In this case salesLine.orig().SalesPrice is the original (already saved)
price, while salesLine.salesPrice is the price that the user is attempting to modify.
Regards,
Siva
Monday, June 14, 2010
Thursday, March 4, 2010
Calling SQL Stored Procedure in X++
Hi All,
It is possible to call a SQL Server Stored Procedure using X++ code.
First you have to create a stored procedure in AX database.Then use the X++ code stated below wherever necessary.
static void callingsp(Args _args)
{
LoginProperty loginProperty;
OdbcConnection odbcConnection;
Statement statement;
ResultSet resultSet;
;
loginProperty=new LoginProperty();
loginProperty.setServer("serverName");
loginProperty.setDatabase("dbname");
try
{
odbcConnection=new OdbcConnection("loginProperty");
catch
{
return;
}
}
statement=myConnection.createStatement();
resultSet=statement.executeQuery('EXEC[spname]'); //stored procedure name
while(resultSet.Next())
{
print resultSet.getString(1);
}
pause;
}
It is possible to call a SQL Server Stored Procedure using X++ code.
First you have to create a stored procedure in AX database.Then use the X++ code stated below wherever necessary.
static void callingsp(Args _args)
{
LoginProperty loginProperty;
OdbcConnection odbcConnection;
Statement statement;
ResultSet resultSet;
;
loginProperty=new LoginProperty();
loginProperty.setServer("serverName");
loginProperty.setDatabase("dbname");
try
{
odbcConnection=new OdbcConnection("loginProperty");
catch
{
return;
}
}
statement=myConnection.createStatement();
resultSet=statement.executeQuery('EXEC[spname]'); //stored procedure name
while(resultSet.Next())
{
print resultSet.getString(1);
}
pause;
}
Siva
Subscribe to:
Posts (Atom)