Share via


Opening and closing tables

There is no explicit "open" operation for a table in Visual Studio Tools. The first time a table buffer is accessed, the table is automatically opened. The table buffer remains open until it is closed.

When your integrating application's code has finished working with a global table buffer, it must be closed using the Close() method for the table. Failing to close a global table buffer will cause a "Background process is running: Exit Aborted" error when the user attempts to exit Microsoft Dynamics GP.

Cc543586.VSTDGP_ExitError(en-us,MSDN.10).gif

For form-level table buffers, the table buffer will be closed when the form is closed. Explicitly closing a form-level table buffer with the Close() method is needed rarely.

The following C# example shows how a table is accessed through a global table buffer. The first row of the table (the RM Customer Master table) is retrieved, and the customer number is displayed. Notice how the table buffer is closed at the end of the example.

RmCustomerMstrTable CustomerMasterTable;
CustomerMasterTable = Dynamics.Tables.RmCustomerMstr;

// Read the first row of the table
CustomerMasterTable.GetFirst();

// Display the name for the row retrieved
MessageBox.Show(CustomerMasterTable.CustomerName.Value);

// Close the table buffer
CustomerMasterTable.Close();