Dataset as a database - is it possible?

  • Thread starter Thread starter Mike Peretz
  • Start date Start date
M

Mike Peretz

I would like to use a dataset as a data file (like a database). However, I
didn't find a way to use SQL on the Dataset (except on a DataView, but then
Dataset is all loaded.). I also noted that I must flush the whole dataset to
disk and load it all to read it. I wonder, if there is a better way to use a
dataset as a persistent storage.
 
You can think of a DataSet as a RDBMS held in memory.

Why do you need to use SQL on a DataSet (there are other ways to CRUD with a
DataSet)?

DataSets are XML Serializable, so taking its contents and storing it to disk
as XML and then reading from that XML is a relatively easy thing to do.
 
It is a really underpowered database - so don't go putting millions of rows
in it.

Other ways to browse data in a dataset are DataTable.Select, Find, Relations
(GetChildRows, GetParentRow). etc.

And instead of complete flush and reload, you could instead do a
dataset.merge.

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
 
Mike,

The answer is simple, No.

The XML file is a file. Not a database.

By instance is it complete single user.

Cor
 
Hello Mike,

As long as you are just storing items and don't need a full fledged RDBMS,
ie a small application or a configuration file, i would go with Scott and
persist as an xml file. Also, you don't need to flush you can update, delete,
insert on your dataset.

In addition to Miha, it really depends on what you are trying to accomplish
 
This is for a very simple layout that will hold no more then 50 records.
Thank you for all your feedback, I think my approch is fine, as long as I
don't go nuts with volunme.
 
Back
Top