473,408 Members | 2,888 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,408 software developers and data experts.

Difference between Delete method and RemoveRow method

CW
I am using a dataset1.xsd and its generated dataset11 object (via the use of
sqldataadapter wizard) to bind to a datagrid.

However, I have found a peculiar problem.

When a user hits the delete button on the datagrid and my code behind
handles the event, I originally chose the following code:

Dim dr As DataSet1.CMRC_CategoriesRow

dr =
Me.Dataset11.CMRC_Categories.FindByCategoryID(CInt (Me.dgProductCategories.It
ems(e.Item.ItemIndex).Cells(0).Text))

Me.Dataset11.CMRC_Categories.RemoveCMRC_Categories Row(dr)

me.sqlDataAdapter1.Update(Me.Dataset11)

However, the above code didn't work. For some reason, the row selected for
deletion never quite gets deleted.

Then I switched to this line code

Me.Dataset11.Tables("cmrc_categories").Rows.Item(e .Item.ItemIndex).Delete()

in place of the first 3 lines of code above.

While the second version is shorter (and most importantly works), why does
the 1st version not work? Conceptually, I prefer the 1st version because I
can avoid using collection indexing where bugs do not show up till run time.

Any ideas?

Thanks in advance

CW

Nov 18 '05 #1
0 711

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

Similar topics

8
by: Chris Mayers | last post by:
'out' and 'ref' parameters in C#... Both these can be used to pass parameter values BACK from a Method, but obviously they are different techniques. As I understand it, 'ref' parameter...
5
by: BBFrost | last post by:
Win2000 ..Net 1.1 SP1 c# using Visual Studio Ok, I'm currently in a "knock down - drag out" tussle with the .Net 1.1 datagrid. I've come to realize that a 'block' of rows highlighted within...
0
by: CW | last post by:
I am using a dataset1.xsd and its generated dataset11 object (via the use of sqldataadapter wizard) to bind to a datagrid. However, I have found a peculiar problem. When a user hits the delete...
12
by: Nathan Sokalski | last post by:
What is the difference between the Page_Init and Page_Load events? When I was debugging my code, they both seemed to get triggered on every postback. I am assuming that there is some difference,...
18
by: Vasileios Zografos | last post by:
Hello, can anyone please tell me if there is any difference between the two: double Array1; and
5
by: rn5a | last post by:
The .NET 2.0 documentation states the following: When using a DataSet or DataTable in conjunction with a DataAdapter & a relational data source, use the Delete method of the DataRow to remove...
6
by: mthread | last post by:
Hi, I am learning C++ and I have been told that an object can be created either by using calloc or new. If it is true, can some one tell me what is the difference b/w using these two function...
11
by: Ed Dror | last post by:
Hi there, I'm using ASP.NET 2.0 and SQL Server 2005 with VS 2005 Pro. I have a Price page (my website require login) with GridView with the following columns PriceID, Amount, Approved,...
13
by: mac | last post by:
hi all, im creating a form wich wil upload images to a folder and their names and other details to a database. im able to do uploading but my delete function is not working, please can anybody...
3
by: C++Liliput | last post by:
Hi, I was looking at the implementation of operator new and operator new in gcc source code and found that the implementation is exactly the same. The only difference is that the size_t argument...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.