D
Drew Yallop
I am updating MS access tables with data in an xml
document. I create two dataset, one for existing data and
one for new data. I fill the first dataset with the
records from MS Access, the second with data from the xml
Document. Both datasets are populated properly. When the
new data contains records that exist in the existing
Access table but with changes in individual elements, the
matching records in the first dataset are not changed and
when an update is performed nothing is done to the
records in the Access table. However, if there are new
records with keys that do not exist in the Access table,
these new records are inserted properly.
I have tried every possible combination of parameters
with no success. Below is code:
ado.daItems.FillSchema(dsCurrent,
SchemaType.Source, "Items");
ado.daItems.FillSchema(dsUpdate,
SchemaType.Source, "Items");
ado.daItems.Fill (dsCurrent, "Items");
columnPosition = 34;
//Get modified date of last
record in Access table
lastModDate =
qbQueryClass.GetLastModDate(dsCurrent, "Items",
columnPosition);
//Retrieve records from
QuickBooks that have been modified since the last
modified date in Access table
qbQueryClass.GetNewRecords
(lastModDate, "ItemUpdateQuery.xml", "ItemRaw.xml", "Trans
formCombined.xslt");
//Read the new records
into a dataset
dsUpdate.ReadXml ("ItemUpdate.xml",
XmlReadMode.IgnoreSchema);
//Merge the dataset with
updated records with the dataset containing the Access
records.
dsCurrent.Merge(dsUpdate,
true, MissingSchemaAction.Error ); //have used all
possible MissingSchemaAction parameters here.
//Update the Access table
ado.daItems.Update
(dsCurrent, "Items");
dsCurrent.Tables.Remove
("Items");
dsUpdate.Tables.Remove
("Items");
dsUpdate.Clear();
dsCurrent.Clear ();
document. I create two dataset, one for existing data and
one for new data. I fill the first dataset with the
records from MS Access, the second with data from the xml
Document. Both datasets are populated properly. When the
new data contains records that exist in the existing
Access table but with changes in individual elements, the
matching records in the first dataset are not changed and
when an update is performed nothing is done to the
records in the Access table. However, if there are new
records with keys that do not exist in the Access table,
these new records are inserted properly.
I have tried every possible combination of parameters
with no success. Below is code:
ado.daItems.FillSchema(dsCurrent,
SchemaType.Source, "Items");
ado.daItems.FillSchema(dsUpdate,
SchemaType.Source, "Items");
ado.daItems.Fill (dsCurrent, "Items");
columnPosition = 34;
//Get modified date of last
record in Access table
lastModDate =
qbQueryClass.GetLastModDate(dsCurrent, "Items",
columnPosition);
//Retrieve records from
QuickBooks that have been modified since the last
modified date in Access table
qbQueryClass.GetNewRecords
(lastModDate, "ItemUpdateQuery.xml", "ItemRaw.xml", "Trans
formCombined.xslt");
//Read the new records
into a dataset
dsUpdate.ReadXml ("ItemUpdate.xml",
XmlReadMode.IgnoreSchema);
//Merge the dataset with
updated records with the dataset containing the Access
records.
dsCurrent.Merge(dsUpdate,
true, MissingSchemaAction.Error ); //have used all
possible MissingSchemaAction parameters here.
//Update the Access table
ado.daItems.Update
(dsCurrent, "Items");
dsCurrent.Tables.Remove
("Items");
dsUpdate.Tables.Remove
("Items");
dsUpdate.Clear();
dsCurrent.Clear ();