Simulating Access Record Update (on leaving the current row)

  • Thread starter Thread starter Tim Mattingly
  • Start date Start date
T

Tim Mattingly

Hi,

i'm new to ado.net and i think this is a very basic question:
i want to use a DataTable as a source for a datagrid placed on my form. I
want to be able to change the records interactively in the datagrid and also
through code, placed behind a button on the same form.
I want to save the changes to the database and fetch the new primary key
like in access:
on leaving the current row
on closing the form

If any update errors occured, i wish to cancel the update, to prevent the
user from leaving the row or closing the form.

Which are the right events and actions i have to use?
Do you have any tips, samples or links?

Thank you,

Tim
 
Hi Tim,

A lot of questions, and therefore only some hints

Have a look at:
..the dataset, not the datatable alone (it is only a wrapper around your
table but makes things easier)
..the datarow.rejectchanges
..changes the datagrid using code is always in the underlaying datasource
(that should not give any problem)
..for the position change look currencymanager.position
..for updating the last row without a position change look at the
bindingmanager endcurrentedit
..closing form event

But it are to much questions to give them all with detailed links or
samples.

However most (falls) are in above I hope that helps?

Cor
 
Hi Cor,

thank you for your response, but 'im a beginner and this is not detailed
enough for me.
More helpful would be a sample project or some sample code, cause i already
found out most of the event-names playing a role in my requests but e.g the
currenymanager.position occurs after a position change, i need an event
which occurs before a position change.

I think there must be a sample project anywhere on the vb.net pages, because
i can imagine that i'm not the only one wishing to have a form database
update similar to microsoft access with ado.net and vb.net.

Does anybody have a link for me?

Thanks,

Tim
 
Back
Top