Udostępnij za pośrednictwem


Calling the business objects

You may add eConnect business logic to an application by directly calling an eConnect SQL stored procedure.

eConnect encapsulates its business logic in a collection of SQL stored procedures. When you use Microsoft Dynamics GP Utilities to create a new company, GP Utilities automatically install the eConnect SQL stored procedures on your Microsoft Dynamics GP SQL server. Since the stored procedures are available on the SQL server, you can use them to add eConnect business logic to your application.

Hint: You should avoid direct calls to the stored procedures. To add eConnect business logic to an application, use the eConnect application programming interface (API) that supports your application's development environment.

Refer to the SQL Server help documentation for information about calling a SQL stored procedure from an application.

If you encounter a situation that requires a direct call to an eConnect stored procedure, your application must address the following:

  • Create a connection to the database server.
  • Implement security restrictions to prevent unauthorized use of your database connection.
  • Implement transaction management to commit or rollback changes.
  • Identify and handle error conditions.
  • Update your application whenever changes are made to the parameters for the stored procedure.

If you call an eConnect SQL stored procedure, you must always assess whether the procedure succeeded. The eConnect stored procedures use the ErrorState element to indicate whether the procedure encountered an error. If the value of ErrorState is 0, the procedure was successful. If the ErrorState value is anything other than 0, an error occurred and the transaction must be rolled back.

Hint: You must check the value of the ErrorState element after each call to an eConnect stored procedure. All eConnect stored procedures reset the ErrorState element to zero when they start.