PC Review


Reply
Thread Tools Rate Thread

dataset row removal

 
 
=?Utf-8?B?YW5kcmV3Y3c=?=
Guest
Posts: n/a
 
      14th Feb 2005
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
 
Reply With Quote
 
 
 
 
=?Utf-8?B?UmFrZXNoIFJhamFu?=
Guest
Posts: n/a
 
      14th Feb 2005
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

 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      14th Feb 2005
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


 
Reply With Quote
 
=?Utf-8?B?YW5kcmV3Y3c=?=
Guest
Posts: n/a
 
      14th Feb 2005
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
lock computer removal policy fails smartcard removal behaviour gesture Microsoft Windows 2000 Group Policy 1 21st Dec 2006 08:48 AM
spyware removal and popup removal pw63 Windows XP Security 2 19th Jan 2004 05:10 PM
Ccopying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N Microsoft ADO .NET 7 9th Dec 2003 02:50 PM
copying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N Microsoft ADO .NET 2 31st Oct 2003 01:05 PM
Ccopying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N Microsoft ASP .NET 2 31st Oct 2003 02:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:02 AM.