tags:

views:

30

answers:

2

I have 150 Nodes in XML ,It have data,,, i want to store Only 5 nodes value into SQl Db in a runtime......

Can u Suggest me

Thanks In Advance

A: 

Your "question" is very vague and broad - and therefore, so is my answer:

I would do this:

  • define a class that holds the five properties you want to store
  • load the XML into a XDocument
  • using Linq-to-XML, iterate over your nodes and extract the five attributes from each node and store them into an instance of that data class you created

  • when you're done with your XML, you could then open a connection to the SQL Server

  • iterate over your list of data classes
  • insert each class into SQL Server using a parametrized T-SQL INSERT statement

So - what part of this process do you need some help with, and what exactly is it you're dealing with?

  • If you need help with parsing the XML - show us the XML (at least a snippet of it).
  • If you need help with inserting into SQL - be specific what you're trying to do, show us what you've tried, and where you had trouble

SO users are glad to help if you have a concrete problem - we're not here to just "gimme the code", however.....

marc_s
A: 

Can you post some sample data / example related to your question? Your question does not address whether you want to select top 5 nodes or else?

mqpasta