Click here to Skip to main content
15,937,602 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Sir,

My table contain one xml column. In that xml column each cell contains xml data How to read that xml data into dataset and display into Gridview

Thanking you.
Posted
Updated 13-Jul-11 1:06am
v3

Dataset ds= new Dataset();
ds.ReadXml("path of the file");
 
Share this answer
 
v2
Comments
[no name] 13-Jul-11 6:13am    
Edited for Code Block.
Ankur\m/ 13-Jul-11 6:20am    
Comment for you here - http://www.codeproject.com/Questions/225177/How-To-Retrieve-Values-from-aResource-Table-into-G
kranthi.oru 13-Jul-11 6:25am    
my requirement is not this in my table I have one link button also when iam click that link button the coresponding cell xml data display into gridview.Before display into anoter girdview first of all i want get it in one dataset.
U send me that code is not suitable for my code.
What I would do is make a class called infoConfig that reads in the data and puts it into like a List. I bet there is a better way to implement it.

public void importArchiveListFromXML(string path)
       {
           //Find and see if the file is there
           FileInfo fileInfo = new FileInfo(path);
           if (fileInfo.Exists)
           {
               XmlTextReader reader = new XmlTextReader(string.Format(fileInfo.FullName));
               reader.WhitespaceHandling = WhitespaceHandling.None;
               AddArchiveInfo(reader);
               reader.Close();
           }
       }

C#
public void AddArchiveInfo(XmlTextReader reader)
        {
            XmlNodeType type;
            while (reader.Read())
            {
                type = reader.NodeType;
                if (type == XmlNodeType.Element)
                {
                    if (reader.Name == "Data")
                    {
                        Dataread(reader);
                    }
                }
            }
        }

C#
public void Dataread(XmlTextReader reader)
        {
            fileExtension = new List<string>();
            while (reader.Read())
            {
                if (reader.Name == "ext")
                {
                    reader.Read();
                    fileExtension.Add(reader.Value);
                    reader.Read();
                }
            }
        }
 
Share this answer
 

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