473,654 Members | 3,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to modify a xml record using asp.net Web Application?

I have a xml document created
<?xml version="1.0" standalone="yes " ?>
<Group>
<Information>
<ID>44</ID>
<Detail>Hello World</Detail>
</Information>
<Information>
<ID>45</ID>
<Detail>My Text</Detail>
</Information>
<Information>
<ID>46</ID>
<Detail>Text Information</Detail>
</Information>
</Group>

I want to know the codes to modify <Detail> according to the <ID>....
for example i enter
textbox1.text = 44
textbox2.text = texts

It can change
<ID>44</ID>
<Detail>Hello World</Detail>
to
<ID>44</ID>
<Detail> texts </Detail>

Are there any codes can do this?
thanks for help
Nov 19 '05 #1
5 1248
Addition

I want to search the ID first then modify the Detail...
Do i need to search the ID first then modify the value in <Detail> ?

Thanks for help
Allan
Nov 19 '05 #2
I found an article where you can update your XmlFile using the
DataSet.WriteXm l method.

http://www.dotnethero.com/hero/xml/U...e.aspx?nmx=4_1

So, you could either use the a DataGrid like in the Article to find whith
record you're updating.
Or you can loop through your dataset finding the ID = 45, then updating your
detail
Followed by DataSet.WriteXm l

HTH

"Allan A via DotNetMonster.c om" <fo***@DotNetMo nster.com> wrote in message
news:53******** ***@DotNetMonst er.com...
I have a xml document created
<?xml version="1.0" standalone="yes " ?>
<Group>
<Information>
<ID>44</ID>
<Detail>Hello World</Detail>
</Information>
<Information>
<ID>45</ID>
<Detail>My Text</Detail>
</Information>
<Information>
<ID>46</ID>
<Detail>Text Information</Detail>
</Information>
</Group>

I want to know the codes to modify <Detail> according to the <ID>....
for example i enter
textbox1.text = 44
textbox2.text = texts

It can change
<ID>44</ID>
<Detail>Hello World</Detail>
to
<ID>44</ID>
<Detail> texts </Detail>

Are there any codes can do this?
thanks for help

Nov 19 '05 #3
Pat
Allan you can also look at this Artice that Updates,Edit ad Insert at:-
http://aspnet.4guysfromrolla.com/articles/112603-1.aspx
Hope that helps
Patrick
"Allan A via DotNetMonster.c om" <fo***@DotNetMo nster.com> wrote in message
news:53******** ***@DotNetMonst er.com...
Addition

I want to search the ID first then modify the Detail...
Do i need to search the ID first then modify the value in <Detail> ?

Thanks for help
Allan

Nov 19 '05 #4
Thanks for help! The sample help me a lot!
but there is another problem...

Dim i As Integer
Dim ds As New DataSet
Try
'Refill the dataset
ds.ReadXml(Serv er.MapPath("Inf ormation.xml"))
'Make the Updates
For i = 1 To ds.Tables(0).Ro ws.Count

If ds.Tables(0).Ro ws(i).Item("ID" ) = txtInputID.Text Then
lbl.Text = "Update record"
Else
lbl.Text = "No match record"
End If
Next

Catch
'Redirect to Error Page or take other action to handle error.
Finally
ds.Dispose()
End Try

it did not have response, if
ds.Tables(0).Ro ws(0).Item("Job ID") = txtInputJobID.T ext Then
it can only find the first record in the xml doc

is the code wrong?

thanks
Allan
I have a xml document created
<?xml version="1.0" standalone="yes " ?>
<Group>
<Information>
<ID>44</ID>
<Detail>Hello World</Detail>
</Information>
<Information>
<ID>45</ID>
<Detail>My Text</Detail>
</Information>
<Information>
<ID>46</ID>
<Detail>Text Information</Detail>
</Information>
</Group>

I want to know the codes to modify <Detail> according to the <ID>....
for example i enter
textbox1.tex t = 44
textbox2.tex t = texts

It can change
<ID>44</ID>
<Detail>Hell o World</Detail>
to
<ID>44</ID>
<Detail> texts </Detail>

Are there any codes can do this?

thanks for help

--
Message posted via DotNetMonster.c om
http://www.dotnetmonster.com/Uwe/For...p-net/200508/1
Nov 19 '05 #5
Allan

I know what is wrong. Thanks for your help again!
--
Message posted via DotNetMonster.c om
http://www.dotnetmonster.com/Uwe/For...p-net/200508/1
Nov 19 '05 #6

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

Similar topics

1
4470
by: Franco Fellico' | last post by:
Hi. Suppose to have read and displayed (using PHP) a group of row of a DB table on a dinamyc table on a HTML/PHP page. The number of row displayed could be from 1 to n. Each row contains informations and also a cell with a unique ID of the element. I would like to show at the beginning of each line of the table a couple of cells containing two different icons (one for delete and one
2
2090
by: karenmiddleol | last post by:
The following code works fine I can connect to a SQL database and list all the records in the Orders table onto a web page. Now our users want me to modify it so that each row displayed as a button or a hyperlink for Modify, Delete and also they want the data displayed not in a HTML table as I am doing but like in a form they want the ability to change the data in the fields. So when the user clicks on the modify button for a row then...
6
74170
by: Who.Really.Really.Cares | last post by:
Hi! I guess this must be a FAQ but I'll give it a try. I've searched the web and usenet archive and found only negative answers. But most of them were dated like 3-4 years back. Hasn't anything changed since then? DB2 V7.2. The problem: I have a table with a primary key GENERATED BY DEFAULT AS IDENTITY. Then I INSERT several rows and force their PK's value. Then I see that my INSERTs haven't modified the value of DB2's internal IDENTITY
4
3589
by: MikeY | last post by:
Hi everyone, I have posted earlier this week, but I'm still scratching my head trying to figure out how to change/modify my data back to my db. Using C# Windows forms. I am trying to learn how to modify existing data with in my DB/MSDE. In general, I have textbox's filled with existing data from my "Employee" table. I have amongst other buttons, an "Update" button. Where, when viewing, if I want to change ie the persons name, anyother...
4
6198
by: muttu2244 | last post by:
Hi everybody Am trying to read a csv file "temp.csv", which has the below info, compName macAddr ipAddr opSys
4
1222
by: MLH | last post by:
On the outside chance that there IS some poor sucker out there named John Doe, Jane Doe or Richard Roe, I'm allowing them to be entered in tblOwners. I need a work-a-round though. Help me out here. I have a qryOwnerList containing no calculated fields - just lists tblOwner records by last name first first name middle name last - you know.. frmEditOwners uses qryOwnerList, sorting owners in a manageable fashion. I do not wish for the...
20
2337
idsanjeev
by: idsanjeev | last post by:
hello i want to modify multiple rows in database with select option i am using R.update but it can update only one record in database but i wants to more then one record is modify after submit so what code i have to use i am using <% If Not IsEmpty(Request.Form("submit")) then vopenflg = Request.Form("vopenflg") vopenflg=trim(vopenflg) conn.close conn.Mode = adModeReadWrite conn.open
1
1270
by: veer | last post by:
hello expert i have a programe in which i want to modify or add new records in excel sheet but it opened read only and when ever i want to insert the record it give the message that give new name to save the changes is there any idea to modify the excel sheet my code is Set x1 = CreateObject("Excel.Application") x1.Workbooks.Open ("c:\var\var2.xls") x1.Visible = True x1.Worksheets(1).Cells(10, 5) = "hello" 'x1.ActiveWorkbook.Save
1
1327
by: vijay1012 | last post by:
How to write code to modify a record. One way is using modify, for example $sqlSession->EditEntity( $objtoedit, "modify" ); But for some reasons i should not use this modify. Is there any way to write a code with out modify.
0
8815
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
8708
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...
1
8489
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7307
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
6161
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
5622
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
4149
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...
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1596
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.