delete a record from datagrid

S

Sam

Hi,
I've filled a dataset with the results of a stored procedure.
I've then filled a datagrid with my dataset.
When I delete the row from my datagrid, I would like to commit the
deletion but I don't know how to do it. Normally I would just call
update on my dataadapter and acceptchanges on my dataset but since I've
filled the dataset with a stored procedure, I'm quite puzzled...

Someone can help ?

thx
 
C

Cor Ligthert

Sam,

Acceptchanges says that the changes should be accepted as are completly
right.
This means by instance for a deleted row that it will be removed from your
dataset.

It is automaticly done by instance by an update from an original dataset.

An often made mistake is that people use a remove and tell that they delete
a datarow. There is a big difference between those two.

When this is not the case than reply

I hope this helps

Cor
 
J

julia

Hi Sam,

It's a little different in this case.

You need to create a new Dataset, with all the changed rows returned by GetChanges function.
You need to have a function that loops through all the rows of the new dataset and pass those
values to another stored procedure to update the database.

HTH

Mona
 
S

Sam

Right. Is GetChanges going to return deleted rows as well ? In that
case I could do that indeed. cheers !
 
S

Sam

actually I have another problem. I would like to call that new stored
procedure (which will take care of the deletion) as soon as the user
has deleted a row from the datagrid. So in which event should I put my
call to the stored procedure ? (I can't find a onDelete-like method of
the datagrid...)
thx
 

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