Update disconnected dataset

  • Thread starter Thread starter Rob Gibbens
  • Start date Start date
R

Rob Gibbens

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("table1").Columns.Add("column1")
dr = ds.Tables("table1").NewRow
dr("column1") = "Value1"
ds.Tables("table1").Rows.Add(dr)

'' HERE IS THE PROBLEM -- FAKE CODE AHEAD
ds.UpdateCommand = "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.
 
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 connectionstring, and I never saw that).

Although all the things you want to do you can do, just write it back with a
ds.writexml(path) 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
 
Back
Top