DeleteEntity Method
Deletes a specified record from Microsoft Dynamics GP.
Class
Microsoft.Dynamics.GP.eConnect.eConnectMethods
Syntax
public bool DeleteEntity(string connectionString, string sXML)
Parameters
Name |
Data type |
Description |
---|---|---|
connectionString |
string |
Specifies your data server and database. |
sXML |
string |
An eConnect XML document. |
Return Value
Type: boolean
The method returns a boolean value that indicates whether the XML document was successfully deleted. A return value of True indicates the operation succeeded.
Remarks
Use the DeleteEntity method to remove a data record from Microsoft Dynamics GP. For example, use DeleteEntity to remove a customer or vendor.
Use the DeleteEntity method with eConnect XML document types that include nodes to delete records. If the schema for a document type does not include a node to delete a record, you cannot use DeleteEntity with that document type.
Examples
The following C# code example deletes a specified customer record. The XML that specifies the customer to delete is retrieved from the file named CustomerDelete.xml. Notice how the DeleteEntity method returns a boolean value.
// Specify the Microsoft Dynamics GP server and database in // the connection string sConnectionString = @"data source=MySrvr;initial catalog=TWO; integrated security=SSPI;persist security info=False; packet size=4096"; // Retrieve the XML that specifies the customer to delete from an XML file // Use the XML in the file to create an XML document XmlDocument deleteCustDoc = new XmlDocument(); deleteCustDoc.Load("CustomerDelete.xml"); deleteCustomerDocument = deleteCustDoc.OuterXml; // Delete the specified customer record bool testResult = e.DeleteEntity(sConnectionString, deleteCustomerDocument);