By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,186 Members | 1,069 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,186 IT Pros & Developers. It's quick & easy.

delete a record from datagrid

P: n/a
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

Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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


Nov 21 '05 #2

P: n/a
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
"Sam" <sa**************@voila.fr> wrote in message news:11**********************@f14g2000cwb.googlegr oups.com...
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

Nov 21 '05 #3

P: n/a
Sam
Right. Is GetChanges going to return deleted rows as well ? In that
case I could do that indeed. cheers !

Nov 21 '05 #4

P: n/a
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

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.