update the database

  • Thread starter Thread starter Irfan
  • Start date Start date
I

Irfan

hi, all

Two question:

1. When a row is deleted or added (or in other words when there is change)
in the datagrid, Is this change actually the change in the underlying
dataset ?

2. which event of datagrid control is fired when a row is deleted or added,
so that i can create the commandbuilder and use dataadapter.update in that
event. Is there any other method to update the changes.

TIA
Irfan
 
Irfan,
1. When a row is deleted or added (or in other words when there is change)
in the datagrid, Is this change actually the change in the underlying
dataset ?

That happens when the user changes from row on the datagrid or when you
execute a endcurrentedid with the buildingcontext.
2. which event of datagrid control is fired when a row is deleted or
added, so that i can create the commandbuilder and use dataadapter.update
in that event. Is there any other method to update the changes.
The commandbuilder builds an update, delete, and insert command accoording
to the select command. (When it is a not to difficult select command)

Changes in a datatarow are kept in the datarow rowstate. Updates, deletes
and inserts are by the dataadapter done accoording to those rowstates.

I hope this helps,

Cor
 
thanks Cor for the reply, however i need to catch the event when a row is
deleted and in that event i want to write oledbAdapter.update
which event is that ?

irfan
 
Irfan,
thanks Cor for the reply, however i need to catch the event when a row is
deleted and in that event i want to write oledbAdapter.update
which event is that ?
That I don't know

Cor
 
That event is the update button that will execute the update.

Private Sub btnUpdate_Click(ByVal sender As System.Object, e As
System.EventArgs) Handles btnUpdate.Click

If DsVendors1.HasChanges then
OleDbDataAdapter1.Update(DsVendors1)
End If

End sub

This is what i have when i added a record to the MSAccess database and
clicked the update button to update the added information.
 

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

Back
Top