Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / June 2004

Tip: Looking for answers? Try searching our database.

Delete Row Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Erica - 09 Jun 2004 23:13 GMT
Hello,

When I delete a row in my dataset, the row state for other rows in the
dataset (other datatables) rowstate is deleted.  Why is that?  Here is the
code I use to delete the row:

I have tried both methods below and get same result:
dataSet.Table1[0].Delete();
dataSet.Tables.Rows.Remove(dataRow);

Thanks
William Ryan  eMVP - 10 Jun 2004 00:29 GMT
Hi Erica:

in your first statement, you aren't specificing a row.  You need to use
DataSet.Tables[TableIndex].Rows[RowIndex].Delete();
or you can use a specific row instead of RowINdex
DataSet.Tables[TableIndex].Rows[dataRow].Delete();

Remember .Remove() != .Delete();  Remove takes it out of the collection so
the adapter will never see it when it does and update b/c it's gone
http://www.knowdotnet.com/articles/efficient_pt4.html
.Delete on the other hand doesn't affect the Rows.Count until you call
Update or AcceptChanges is called (Update calls AcceptChanges)

HTH,

Bill
Signature

W.G. Ryan MVP Windows - Embedded

http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/

> Hello,
>
[quoted text clipped - 7 lines]
>
> Thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.