Copying data from a RecordSet object to a DataSet object

You may need to copy the data in a RecordSet object returned by a Commerce Server function into an ADO.Net DataSet object. This is useful for data-binding the DataSet object, for converting it into XML, and so on.

Solution

The following Microsoft Visual C# example illustrates this copy functionality.

// get a Recordset
CatalogManager cm;
_Recordset rs = cm.Catalogs;

// copy Recordset data into DataSet
DataSet ds = new DataSet();
OleDbDataAdapter myLoader = new OleDbDataAdapter();
myLoader.Fill(ds, rs, "Catalogs");

Copyright © 2005 Microsoft Corporation.
All rights reserved.