DataView allowInsert, allowUpdate, allowDelete vs DataSet?

A

Aaron Lind

Does anyone know why the allowInsert, allowUpdate and allowDelete
methods are available for a dataview and not available within a
dataset?
I know I can trap events for a datatable for the editing of rows but I
have found different results (as to whether the event gets fired)
given different update scenarios. Is it best to use dataviews to
manage editing of records in windows forms and not to bind to a
dataset at all? Any info would be greatly appreciated.

Thanks ahead of time,

Aaron
 
M

Miha Markic

Aaron Lind said:
Does anyone know why the allowInsert, allowUpdate and allowDelete
methods are available for a dataview and not available within a
dataset?

You mean datatable. Maybe becuase datatable is meant more to be "storage
only".
I know I can trap events for a datatable for the editing of rows but I
have found different results (as to whether the event gets fired)
given different update scenarios. Is it best to use dataviews to
manage editing of records in windows forms and not to bind to a
dataset at all? Any info would be greatly appreciated.

Even if you bind DataTable acutally its DefaultView is bound to.... so you
are always binding DataView.
 
W

William Ryan

It really depends on what your ultimate goal is...

For instance, if you have a DataSet with Related Tables, and you want the
parents and children to appear in a Grid with the expandable/collapseable +
marks, using a Dataset is the only way I know of.

On the other hand, if you have a combobox and you want to be able to filter
it dynamically, binding to a view and then changing the rowfilter is an
excellent way to change what's displayed on the fly. Binding a control with
complex binding is different from simple in that you can call
DataSource/DisplayMember/ValueMember as opposed to calling the
Control.DataBindings.Add(Property, DataSet, Table.Fied))


What problems are you having with the DataSet?
 
A

Aaron Lind

First off I would like to say thanks for the quick responses and the
useful info. I haven't had much of a chance to work at the form level
and I didn't realize that a view was always being used as the data
source by default during complex binding.
I do have a few questions. 1) I have found that the allowInsert
and allowDelete options set to false seem to work well, regardless if
the design is to allow the user to delete from a grid or if (for the
add) a detail form is opened and the currencyManager.AddNew attempts
to add the record, both fail. But what about an edit scenario where a
detail form is presented to the user with text boxes, datTime pickers,
ect. and simple binding is used. I bind like this:
Me.txtComments.DataBindings.Add("text", medsView, "comments")
I find that editing the text is allowed and even if a save button is
hit and the edits are ended:

For Each entry In Me.BindingContext
CType(CType(entry.Value, WeakReference).Target,
BindingManagerBase).EndCurrentEdit()
Next entry

The value is still accepted. What do I need to do in order to get
this type of simple binding editing to throw the errors like the add
and delete?

2) I have read that some say to avoid the currency manager, any
advice?

Thanks again for the help.

Aaron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top