473,387 Members | 1,597 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,387 software developers and data experts.

dataset row removal

When I perform this action, bChanges still remains false.
Naturally I cannot persist the change because the dataset
appears unmodified. Why is that ???

_dsAllTables.Tables[tableName].Rows.RemoveAt(rowIndex);
bool bChanges=_dsAllTables.HasChanges();

Thanks in advance
--
Andrew
Nov 16 '05 #1
3 2854
Hi,

Use the Delete method rather then the RemoveAt method. This is because,
Delete marks a row for deletion, modifying the HasChanges value, whereas
RemoveAt doesn't.

Eg.:
DataRow row = data.Tables[0].Rows[3];
row.Delete();

Have a look at:
www.msdn.microsoft.com/library/en-us/
cpguide/html/cpconDeletingDataRowFromDataTable.asp

HTH,
Rakesh Rajan

"andrewcw" wrote:
When I perform this action, bChanges still remains false.
Naturally I cannot persist the change because the dataset
appears unmodified. Why is that ???

_dsAllTables.Tables[tableName].Rows.RemoveAt(rowIndex);
bool bChanges=_dsAllTables.HasChanges();

Thanks in advance
--
Andrew

Nov 16 '05 #2
Andrew,

In addition to Rakesh

A remove(at), really removes a row from a datarowcollection.
A delete marks it as to be deleted. What is done with the acceptchanges.

A delete from a newly inserted datarow acts the same as a remove by the way.

Just a little addition,

Cor
Nov 16 '05 #3
THANKS,
System.Data.DataRow dr = _dsAllTables.Tables[tableName].Rows[rowIndex];
dr.Delete();
bool bChanged=_dsAllTables.HasChanges();

WORKS PERFECTLY.

"andrewcw" wrote:
When I perform this action, bChanges still remains false.
Naturally I cannot persist the change because the dataset
appears unmodified. Why is that ???

_dsAllTables.Tables[tableName].Rows.RemoveAt(rowIndex);
bool bChanges=_dsAllTables.HasChanges();

Thanks in advance
--
Andrew

Nov 16 '05 #4

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

Similar topics

0
by: postmaster | last post by:
**************** eManager Notification ***************** The following mail was blocked since it contains sensitive content. Source mailbox: <python-list@python.org> Destination mailbox(es):...
2
by: Mirko Zeibig | last post by:
Hello everybody, I recently stumbled across the proposal of removing `callable` in Python 3000 (http://python.org/peps/pep-3000.html) catching an exception instead, maybe something like this:...
0
by: Viper99 | last post by:
Need to detect (receive notification) for the insertion/removal of PCMCIA devices on Windows 2000/XP in a C# .Net application. Was able to do this in ATL COM app using CWnd::OnDeviceChange().
4
by: Tarique Jawed | last post by:
Alright I needed some help regarding a removal of a binary search tree. Yes its for a class, and yes I have tried working on it on my own, so no patronizing please. I have most of the code working,...
2
by: Christopher Weaver | last post by:
I'm trying to insert a new Row within an existing Table within an existing DataSet using the following: DataRow NewTaskRow = dsTaskActivities.Tables.NewRow();...
3
by: sanjana | last post by:
hi willy i have done the code for detecting insertion/removal of device at USB port thanx for ur advice but is there way to detect if sd card is inserted or removed from the device at usb tht...
2
by: Phil | last post by:
I need to created a typed dataset for a xml flat file and bind that dataset to a combobox. I was able to do this in VS.Net 2003 easy enough, but can't get it to work in VS.Net 2005. I've come...
3
by: tschwartz | last post by:
I'm trying to write a stylesheet which removes nodes which are empty as a result of other template processing. For example, given the following xml, I'd like to: - remove all "b" elements -...
1
by: irfan200x | last post by:
Does Any Body Have The Key and User name of Adware removal 8.0.1 Please give me the key and user or some one have a Adware Removal 8.0.1 Full Software then send to me to this id thak you bye
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: 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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.