如何将XMLstring转换为DataView? [英] How to convert XMLstring to DataView?

查看:66
本文介绍了如何将XMLstring转换为DataView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用sedna,此代码将XML代码保存在 SednaQueryResults 变量中:



I work with sedna, and this code save the XML code in SednaQueryResults variable:

SednaQueryResults sqResult = sSession.Execute(XQyeryStr);





我想从这个变量中获取值,以便在 GridView中查看它



我尝试将其转换为数组作为下一个:





I want to get values from this variable to view it in GridView

I tried to convert it to array as next:

string[] resArr = sqResult.ToArray();





并将其放入Gridview



and put it in Gridview

GV.DataSource = resArr ;
            GV.DataBind()





但它只给了我一个项目,每个项目都包含要用XML收集的整行



如下:







but it gave me just a items, each item contain the whole row to gather in XML

As next:


Item
<Tutors> <Tutors> <TutorID>a45b90eb-d028-48af-b3ea-e42f11dad64b</TutorID> <FirstName>ahmad</FirstName> <LastName>yousef</LastName> <NickName>Ahmad yosuef</NickName> <Gender>Male</Gender> <BirthDate>1/1/1970</BirthDate> <HomeCity>دمشق</HomeCity> <Address>here</Address> <Mobile>094778263</Mobile> <Email>here2j113f@gma.com</Email> <Class>1</Class> <Subject>رياضيات</Subject> </Tutors> <TutorID/> <FirstName/> <LastName/> <NickName/> <Gender/> <BirthDate/> <HomeCity/> <Address/> <Mobile/> <Email/> <Class/> <Subject/> </Tutors>
<Tutors> <TutorID>a45b90eb-d028-48af-b3ea-e42f11dad64b</TutorID> <FirstName>ahmad</FirstName> <LastName>yousef</LastName> <NickName>Ahmad yosuef</NickName> <Gender>Male</Gender> <BirthDate>1/1/1970</BirthDate> <HomeCity>دمشق</HomeCity> <Address>here</Address> <Mobile>094778263</Mobile> <Email>here2j113f@gma.com</Email> <Class>1</Class> <Subject>رياضيات</Subject> </Tutors>









如何将此XML转换为Dataview以明确方式将其放入Gridview?!





How can I convert this XML to Dataview to put it in Gridview in clear way?!

推荐答案

最简单的方法恕我直言如下:



从xml加载数据集:

https://msdn.microsoft.com/en-us/library/fx29c3yd(v = vs.110).aspx [ ^ ]

有几种方法可以做到这一点,但它们在上面的链接中有描述。看看并找到适合你的一个





然后将数据集或表绑定为源对象
Easiest way IMHO is as follows:

Load dataset from xml:
https://msdn.microsoft.com/en-us/library/fx29c3yd(v=vs.110).aspx[^]
There are several ways to do this but they are described in the link above. Take a look and find one that works for you


Then just bind the dataset or table as your source object


这篇关于如何将XMLstring转换为DataView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆