[ Team LiB ] Recipe Updating Data Asynchronously Using Message Queuing Problem You need to asynchronously update data on a database on system that is not always connected. Solution You must use message queuing and an XML DiffGram to | Team LiB Recipe Updating Data Asynchronously Using Message Queuing Problem You need to asynchronously update data on a database on system that is not always connected. Solution You must use message queuing and an XML DiffGram to Construct and send an MSMQ message containing a DiffGram to the server. Extract the DiffGram from the message and use it to update the data source at the server. Construct and send a message containing the latest DataSet to the client. Retrieve the response at the client and deserialize it into a DataSet. The sample code contains four event handlers Sets up the sample by loading a DataSet with the Customers table from the Northwind database. The default view of the table is bound to a data grid on the form. Send Update Checks if the update message queue exists and creates it if necessary. A MessageQueue object is created to access the queue. A message is created containing a DiffGram of the changes made to the DataSet containing the Customers table. This message is sent to the update queue. Process Update Checks if the update message queue exists and creates it if necessary. A MessageQueue object is created to access the queue. An attempt is made to receive a message from the queue waiting one second before giving up. If a message is received a DataAdapter that uses a CommandBuilder to generate updating logic is created and used to update the database with the changes in the DataSet contained in the body of the message. The latest version of the Customers table is retrieved into a new DataSet. A result queue is created if necessary and a message containing the latest DataSet is sent to the queue. Receive Update Checks if the result message queue exists and creates it if necessary. A MessageQueue object is created to access the queue and the formatter set to deserialize the DataSet in the message bodies. An attempt is made to receive a message from the queue waiting one second before .