473,325 Members | 2,860 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,325 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 726

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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.