Click here to Skip to main content
15,885,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I work with sedna, and this code save the XML code in SednaQueryResults variable:

C#
SednaQueryResults sqResult = sSession.Execute(XQyeryStr);


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

I tried to convert it to array as next:

C#
string[] resArr = sqResult.ToArray();


and put it in Gridview
C#
GV.DataSource = resArr ;
            GV.DataBind()


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

As next:


XML
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>




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

1 solution

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
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900