Update disconnected dataset

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

    #1

    Update disconnected dataset

    If I manually create my own dataset with no backing database, is it
    possible to run an Update sql command on this dataset? What I would
    like to do is this

    Dim ds as New DataSet
    Dim dr as DataRow

    ds.Tables.Add(" table1")
    ds.Tables("tabl e1").Columns.Ad d("column1")
    dr = ds.Tables("tabl e1").NewRow
    dr("column1") = "Value1"
    ds.Tables("tabl e1").Rows.Add(d r)

    '' HERE IS THE PROBLEM -- FAKE CODE AHEAD
    ds.UpdateComman d = "Update table1 SET column1 = 'Value2'"
    ds.Update()

    Is there any way to do this? Everything I've seen involves using a
    DataAdapter with an underlying connection to a database.
  • Cor Ligthert

    #2
    Re: Update disconnected dataset

    Rob,

    The XML dataset on disk is not a database and therefore not accessable with
    SQL commands. A XML dataset is just a file, that can be saved and
    transported for which is very much usable, however no database.

    And therefore you can not access it using SQL statements. (The first thing
    you would need for that is a connectionstrin g, and I never saw that).

    Although all the things you want to do you can do, just write it back with a
    ds.writexml(pat h) that new table should be in it

    (What you want to do on the database does not go by the way, there is a lot
    missing for that)

    I hope this helps anyway?

    Cor



    Comment

    Working...