any buddy can tll me how to insert data in database using Xml file.

Do you want to using C# to take data from an Xml file and then insert it into a DB using C# or parse it to Xml and then store it in the DB using Xml ?

i want to parse th XML then save the data if the data is in multiple row then how to handle that

The code below should load the xml file from the file path that is given, converts all child nodes of the outer most parent mode and stores it in an object's properties.

XmlDocument config = new XmlDocument();
                //Loads existing Xml document, located at directory passed to parameter
                config.Load(your_file_path);

                //Creates instance of all node within loaded Xml docuemnt and retrieves element by tag name
                XmlNodeList ObjectTypeID = config.GetElementsByTagName("ObjectTypeID");
                
		//Loops through foreach for each element specified by GetElementByTagName("")
                foreach (XmlNode n in ObjectTypeID)
                {
                    //Converts XmlNode to XmlElement
                    XmlElement _ObjectTypeID = (XmlElement)n;
                    //Converts and stroes value of specified attribute in property of ObjectTypeState class
                    objtyp.ObjectTypeID = Convert.ToInt32(_ObjectTypeID.GetAttribute("ID"));
                }

                XmlNodeList StateType = config.GetElementsByTagName("StateType");
                foreach (XmlNode n in StateType)
                {
                    XmlElement _statetype = (XmlElement)n;
                    objtyp.StateType = Convert.ToInt32(_statetype.GetAttribute("ID"));
                }

                XmlNodeList State = config.GetElementsByTagName("State");
                foreach (XmlNode n in State)
                {
                    XmlElement _State = (XmlElement)n;
                    objtyp.State = Convert.ToInt32(_State.GetAttribute("ID"));
                }
[DefaultPropertyAttribute("ObjectTypeID")]
    public class ObjectTypeState
    {

        #region Get/ Set properties
        //This region contains the Get and Set properties for each pricariable

        //Defines the catagory of which the property will be an attribute of, also sets the description of the attribute
        [CategoryAttribute("Main Object Type State Identifiers"), DescriptionAttribute("Object type ID"), ReadOnlyAttribute(true)]
        public int ObjectTypeID 
        {
            get;
            set;            
        }

        [CategoryAttribute("Main Object Type State Identifiers"), DescriptionAttribute(" state type of Object type"), ReadOnlyAttribute(true)]
        public int StateType
        {
            get;
            set;
        }

        [CategoryAttribute("Main Object Type State Identifiers"), DescriptionAttribute("state of object type"), ReadOnlyAttribute(true)]
        public int State
        {
            get;
            set;
        }
}

you'll need to know the structure of the Xml tree. so what are the parent nodes of the Amount and the ItemID. can out do a print screen of the xml document in you browser and attach it or see if you can put it in code brackets.

Have a look at these too and do a bit more research.

this
or
this

This article has been dead for over six months. Start a new discussion instead.