Groups | Blog | Home
all groups > vb.net > february 2006 >

vb.net : Saving a Database to Disk


Jager
2/2/2006 6:27:55 PM
Ok, I've got a program I am working on that is supposed to save all
changes to the dataset to the actual database, but this doesn't seem to
be working. I used the DataAdapter.Update(DataSet) method, but that
doesn't save the changes to my actual database.

How can I go about updating the actual database to save changes?
Please help,
Jager
Cor Ligthert [MVP]
2/3/2006 12:00:00 AM
Jager,

A dataadapter update does only save datarows from which the rowstate is not
"not changed".

However how a rowstate is set, depends very much how your program is build,
so therefore you have to tell more.

Cor

Jager
2/3/2006 9:58:33 AM
Well I can use the commands to add information to my database and it
saves the changes to the database itself, but when I delete rows by
using RemoveAt for the CurrentSelectedRow , the database won't save the
changes. I have also tried the delete method and I don't beleve that
worked. What I need it to do is save the changes to the database in
anyway possible without manually saving the changes ( I can't expect
the person using this to save on his own.) If I can get this all to
work, I'll be in good shape, I think.
Kerry Moorman
2/3/2006 10:29:00 AM
Jager,

You need to use Delete if you are trying to mark the row for deletion from
the database.

Kerry Moorman


[quoted text, click to view]
Cor Ligthert [MVP]
2/4/2006 12:00:00 AM
Jager,

In addition to Kerry,

RemoveAt or all other Removes in this situations, remove a datarow complete
from a datatable with all its aspects.

A delete, set the row to be removed after and update or with an
acceptchanges.

(This alone for those row for which this is important. newly added rows will
be with delete as well direct removed from a datatable)

I hope this helps,

Cor

AddThis Social Bookmark Button