Victor Charles
asked on
How to loop loop through a dataset to update xml file based on rows selected from a grid?
Hello,
I'm trying to update a Link.xml file based on the value of an Fuze.xml file. How do you loop through the Fuze.xml file and set the Link Files' Fuze_ID = PFuze_ID of the Fuze file where Fuze_ID of the Link File = Fuze_ID of the Fuze file? I started writing the code, but would very much appreciate your help with the proper syntax.
Dim ds As New DataSet
ds.ReadXml(Application.Sta rtupPath + "\Link.xml")
Dim dsFuze As New DataSet
dsFuzeA.ReadXml(Applicatio n.StartupP ath + "\Fuze.xml")
Dim dt As DataTable = ds.Tables(0)
Dim r As DataRow = dt.NewRow
r!Link_ID = dt.Rows(dt.Rows.Count - 1)("Link_ID") + 1
r!Fuze_ID = C1FuzeGrid.Columns(0).Valu e
'*****************
For ???????
If dsFuzeA.Fuze_ID = C1FuzeGrid.Columns(0).Valu e then
r!PFuze_ID = dsFuzeA.PFuzeID
Endif
Next
'***************
dt.Rows.Add(r)
ds.WriteXml(Application.St artupPath + "\Link.xml")
Thanks,
Victor
I'm trying to update a Link.xml file based on the value of an Fuze.xml file. How do you loop through the Fuze.xml file and set the Link Files' Fuze_ID = PFuze_ID of the Fuze file where Fuze_ID of the Link File = Fuze_ID of the Fuze file? I started writing the code, but would very much appreciate your help with the proper syntax.
Dim ds As New DataSet
ds.ReadXml(Application.Sta
Dim dsFuze As New DataSet
dsFuzeA.ReadXml(Applicatio
Dim dt As DataTable = ds.Tables(0)
Dim r As DataRow = dt.NewRow
r!Link_ID = dt.Rows(dt.Rows.Count - 1)("Link_ID") + 1
r!Fuze_ID = C1FuzeGrid.Columns(0).Valu
'*****************
For ???????
If dsFuzeA.Fuze_ID = C1FuzeGrid.Columns(0).Valu
r!PFuze_ID = dsFuzeA.PFuzeID
Endif
Next
'***************
dt.Rows.Add(r)
ds.WriteXml(Application.St
Thanks,
Victor
ASKER
Hi,
I need help with the syntax for steps 2 and 3.
For ???????
If dsFuzeA.Fuze_ID = C1FuzeGrid.Columns(0).Valu e then
r!PFuze_ID = dsFuzeA.PFuzeID
Endif
Next
Victor
I need help with the syntax for steps 2 and 3.
For ???????
If dsFuzeA.Fuze_ID = C1FuzeGrid.Columns(0).Valu
r!PFuze_ID = dsFuzeA.PFuzeID
Endif
Next
Victor
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
1. Loop through rows in link dataset
2. Loop through rows in fuze dataset
3. Check condition for the values in link and fuze ds
4.if condition satisfies change the value in link ds
5. Again write the dataset into XML.