473,385 Members | 1,392 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Deleting a row from a dataset using DeleteCommand

I do not want to delete the row from the database when the user clicks
"delete" on the datagrid. I want to mark the dataset record as
deleted, and let the DataAdapter call the delete sproc when the "save"
button is clicked.

In the datagrid1_deletecommand function, .NET returns e.item, which
points to the DATAGRID row. How do I get a pointer to the DATASET row
that was used to create the grid row?

I can't use the e.Item.ItemIndex, because it doesn't account for
previously deleted records. I thought perhaps the e.Item.DataItem
sounded right, but it comes back null.

tia
Dan

Apr 25 '07 #1
3 3377
Dan,

By default, everything should already be working exactly the way you say you
want it work.

Kerry Moorman
"DanG" wrote:
I do not want to delete the row from the database when the user clicks
"delete" on the datagrid. I want to mark the dataset record as
deleted, and let the DataAdapter call the delete sproc when the "save"
button is clicked.

In the datagrid1_deletecommand function, .NET returns e.item, which
points to the DATAGRID row. How do I get a pointer to the DATASET row
that was used to create the grid row?

I can't use the e.Item.ItemIndex, because it doesn't account for
previously deleted records. I thought perhaps the e.Item.DataItem
sounded right, but it comes back null.

tia
Dan

Apr 25 '07 #2
I would have expected things to work as expected, but they don't seem
to. Here's what I see:

Let's say there are two rows in the dataset, A and B. They display in
the grid as rows 0 and 1. If the user clicks to delete row 0, the
datagrid1_deletecommand e.item.itemindex returns 0, and I mark A as
"deleted". After the next databind, B is now in the grid at row 0.
Again, the user clicks to delete. I hoped the itemindex would come
back as 1, but it's again 0. Dataset row 0 (A) is already deleted. I
don't want A. I want B.

At that point, what connects grid row 0 to dataset row B?

Dan

Apr 26 '07 #3
Note: I'm using .Net Framework 1.1

Apr 26 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mark | last post by:
Not sure this is the right place for this questions, but here goes: I get an error message when deleting an table from a Access database. The code is as follows and the error message is after...
6
by: Mark | last post by:
I get an error message when deleting rows from a table in Access database. My understanding is that the error message relates to the sharing of the Inetpub and the wwwroot directory. While I...
4
by: Mark | last post by:
Not sure this is the right place for this questions, but here goes: I get an error message when deleting an table from a Access database. The code is as follows and the error message is after...
5
by: Grant | last post by:
Hello, How come when I add a new row to my dataset table it shows up as changed (agencyData.Haschanges() = True) but when I delete a row the dataset thinks here are no...
1
by: Mark | last post by:
Not sure this is the right place for this questions, but here goes: I get an error message when deleting an table from a Access database. The code is as follows and the error message is after...
5
by: Robert Brown | last post by:
Hi All. I have a routine that checks a SQL Table for all records 3 months prior to a predetermined date, then I insert them into an Archive DB then delete those records from the original table....
8
by: Dot Net Newbie | last post by:
New to DOTNET so please be gentle: I have an in-memory dataset that I want move to a SQL Server database. The XML schema with which the dataset was built matches exactly the table schema in SQL...
0
by: Mateusz [PEYN] Adamus | last post by:
Hi I have a Typed DataSet. I've databinded it to some text controls on my form, controls show data when I show record. But now I would like to create a new record with this form, controls...
1
by: Johnny E. Jensen | last post by:
Hello To update a dataset i created a method (see below) My question is, how to return the created Primary ID that is created on the server auto incremential. Is there anyway to place that value...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.