473,698 Members | 2,616 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delete Row from DataTable

Through searching on the web, I have learned how to delete a row from a
DataTable. My problem is that I need to delete a certain row. I am
writing an XML file into a DataSet, the file is below.

<States>
<state>
<id>NY </id>
<Flat>False</Flat>
<Taxes>
<Tax>
<Min>0</Min>
<Max>124.99</Max>
<Value>4.25</Value>
</Tax>
<Tax>
<Min>125</Min>
<Max>999999</Max>
<Value>6.25</Value>
</Tax>
</Taxes>
</state>
</States>

The two items in the child element Tax have the same identifier. That
is where my problem arises. The only way I have found to delete one of
the Tax elements is by using the identifier. But both of those elements
has the same idetifier.

I would like to know if there is anyway to use the Value node to delete
the record? With all of my searches, I can only find ways to delete
using the identifier. Any help would be appreciated.

Thanks for any help

Scott Moore

Oct 5 '06 #1
1 1327
Samoore,

You can use the dataview.find to get the index.
http://windowssdk.msdn.microsoft.com.../18kktzs4.aspx

I hope this helps,

Cor
"samoore33" <sa*******@gmai l.comschreef in bericht
news:11******** **************@ c28g2000cwb.goo glegroups.com.. .
Through searching on the web, I have learned how to delete a row from a
DataTable. My problem is that I need to delete a certain row. I am
writing an XML file into a DataSet, the file is below.

<States>
<state>
<id>NY </id>
<Flat>False</Flat>
<Taxes>
<Tax>
<Min>0</Min>
<Max>124.99</Max>
<Value>4.25</Value>
</Tax>
<Tax>
<Min>125</Min>
<Max>999999</Max>
<Value>6.25</Value>
</Tax>
</Taxes>
</state>
</States>

The two items in the child element Tax have the same identifier. That
is where my problem arises. The only way I have found to delete one of
the Tax elements is by using the identifier. But both of those elements
has the same idetifier.

I would like to know if there is anyway to use the Value node to delete
the record? With all of my searches, I can only find ways to delete
using the identifier. Any help would be appreciated.

Thanks for any help

Scott Moore

Oct 6 '06 #2

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

Similar topics

0
1332
by: Mark Jones | last post by:
I'm trying to delete a row from a DataGrid using a ButtonColumn with CommandName="Delete" by deleting the row in the underlying DataTable datasource, but it doesn't seem to be working at the minute. I'm using session data to fill the DataTable which subsequently fills the DataGrid. The code is as follows (with "dgBasket" as the DataGrid): private void dgBasket_DeleteCommand(object source,...
2
2566
by: Mark Jones | last post by:
I'm trying to delete data from a DataGrid using a ButtonColumn with a CommandName="Delete" but it's not working a the min. I'm using session data which fills a DataTable which then fills the DataGrid. The code is as follows (dgBasket is the DataGrid): private void Page_Load(object sender, System.EventArgs e) { DataTable myTable = (DataTable) Session;
5
25457
by: tony010409020622 | last post by:
I just spent 4 months taking a dotnet class where i learned very little. One of the things I did not learn is this: What are the dotnet equivilents of commands such as: Adodc1.Recordset.AddNew Adodc1.Recordset.Update Adodc1.Recordset.MoveFirst Adodc1.Recordset.MoveNext Adodc1.Recordset.Delete
0
1049
by: Giovanni pepe | last post by:
This is my error : <<impossible to approach the information on the line eliminated through the line>> This is my code for updateBatch : Private mSqlConn as sqlConnection Public Function UpdateBatch(ByVal DTable As DataTable) Dim mSqlDa As SqlDataAdapter Dim MustCloseConnection As Boolean
16
17549
by: Sam | last post by:
Hi, As I loop through a dataview's records, I delete datarow based on a condition. However I don't want to commit those deletions until the loop ends. With a datatable, i would just set row.delete() and call AcceptChanges when the loop ends. But how can I do that with a dataview ? Thank you
6
3854
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called "Generations"), and it allows the user to add, edit and delete the various records of the table. "Generations" table has the following fields: "IDPerson", NamePerson", "AgePerson" and "IDParent". A record contains the information about a person (his name, his...
5
3105
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 the row. The Delete method marks the row as Deleted in the DataSet or DataTable but does not remove it. Instead when the DataAdapter encounters a row marked as Deleted, it executes its DeleteCommand method to delete the row at the data source. The...
10
2968
by: amiga500 | last post by:
Hello, I have one basic simple question. When I have multiple records in the datagrid as follows: Code Product 1 Product 2 Product 3 11111 A B C 22222 D E F 33333 G H I 44444 J K L
2
1564
by: JoaquimC | last post by:
Hello, I need to delete a group of rows from a DataTable based on a condition. Something like: string CRefeicao = "01", CFamiliaPrato = "02"; foreach (DataRow LinhaDetalhe in Detalhe.Rows) { string Crefeicao2 = LinhaDetalhe.ToString(); string CFAmiliaPrato2 = LinhaDetalhe.ToString();
4
7947
by: AW | last post by:
XP & VB 2005 using the help files - followed instructions to use the table adapter to delete a row from the database. I step thru the table find the rows to delete and issue a .Delete() and after having done that for all the rows I want to delete issue an AcceptChanges(). I get NO errors but the database is unchanged. Google has several suggestions that seem very complex. VB 2005 is supposed to be simple and direct - Not? Help?...
0
8610
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7740
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2339
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.