Help !

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gary

    #1

    Help !

    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

    OleDbDataAdapte r.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 OleDbDataAdapte r.Update(Datase t, 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



  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Help !

    Gary,

    You are calling the Update method, not the Fill method. The documentation is in reference to the Fill method by itself not the ADO.NET data set. The error you are getting is a result of not having an update command assigned to the UpdateCommand property of the data adapter. The data adapter needs this in order to update the underlying data source.

    Hope this helps.

    --
    - Nicholas Paldino [.NET/C# MVP]
    - nick(d0t)paldin o=At-exisconsulting' dot|com

    On Mon, 6 Oct 2003 09:29:28 +0530, Gary <msnews@microso ft.com> wrote:
    [color=blue]
    > 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
    >
    > OleDbDataAdapte r.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 OleDbDataAdapte r.Update(Datase t, 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
    >
    >
    >[/color]



    --
    - Nicholas Paldino [.NET/C# MVP]
    - nick(d0t)paldin o=At-exisconsulting' dot|com

    Comment

    Working...