help !

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

HI,

I'm facing a problem while updating a ADO recordset after modifying its

records using the Dataset( ADO.Net).

I'm calling a method of a COM component from C# code. The method returns a

disconnected ADO recordset object which I use to fill the Dataset using the

OleDbDataAdapter.Fill() method. Then I modify the records using

Dataset.Tables[].Rows[].[FiledName].

I want to get these modified records reflected back into the ADO recodset

as I want to call another COM method with the ADO recordset as an input

parameter.

To do this, when I use the OleDbDataAdapter.Update(Dataset, TableName)

method, it throws an exception that says "Update requires a valid

Updatecommand". MSDN documentation about the Fill method is as follows:

"Filling a DataSet with the contents of an ADO object is a one-way

operation. That is, data can be imported from the ADO Recordset or Record

into the DataSet, but any updates to the data must be handled explicitly.

However, once you have populated a DataSet with data from an ADO object,

you can resolve changes back to the data source using a DataAdapter, and

you can also write data as XML."

In this case, what does it mean by one-way operation? If it is a one-way

operation, how do we resolve the changes back to the data source which is a

ADO recordset in this case?

TIA,

Gary
 
Hi Gary,

I'd guess you'd need to:

1. Use GetChanges to get a dataset containing just the changes.
2. Create a disconnected recordset in ADO.
3. Populate the recordset by cycling through the dataset of changes.
4. Use the disconnected recordset to do the update.

Not what you're hoping for I'm sure... :-)

HTH,
 
Back
Top