473,395 Members | 1,442 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,395 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 919

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: 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...
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
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...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.