Compartir a través de


UpdateEntity Method

Updates a specified record in Microsoft Dynamics GP.

Class

Microsoft.Dynamics.GP.eConnect.eConnectMethods

Syntax

public bool UpdateEntity(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 updated. A return value of True indicates the operation succeeded.

Remarks

Use the UpdateEntity method to update an existing data record in Microsoft Dynamics GP. For example, use UpdateEntity to update existing customer or vendor records.

To update a document, create a string that represents the updated eConnect XML document. Use the string as the sXML parameter.

If an error occurs, the method throws an eConnectException, application exception, or exception.

Examples

The following C# code example updates a customer. The XML that specifies the customer and the updated data is retrieved from a file. Notice how the UpdateEntity method returns a boolean value.

// Use an XML document to specify the customer and the updated data
XmlDocument updateCustDoc = new XmlDocument();
updateCustDoc.Load("CustomerUpdate.xml");
updateCustomerDocument = updateCustDoc.OuterXml;
// 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";
//UpdateEntity
bool testResult = e.UpdateEntity(sConnectionString, updateCustomerDocument);

See Also