<item>
<HaberKodu </HaberKodu>
<Kategori</Kategori>
<Sehir</Sehir>
<title</title>
<description></description>
<pubDate></pubDate>
<images>
<image> 1 </image>
<image> >2 </image>
<image> 3 </image>
<image> 4 </image>
<image> 5 </image>
<image> 6 </image>
</images>
<small_images>
<small_image>1 </small_image>
<small_image> 2 </small_image>
<small_image> 2 </small_image>
</small_images>
<Aciklamalar>
<Aciklamala>1 </Aciklamala>
<Aciklamala> 2 </Aciklamala>
<Aciklamala> 3 </Aciklamala>
</Aciklamalar>
<link> </link>
/item>
protected void Button1_Click(object sender, EventArgs e)
{
XmlDocument xml = new XmlDocument();
xml.Load("XML FİLE");
XmlNodeList kayitlar = xml.SelectNodes("/rss/channel/item");
foreach (XmlNode item in kayitlar)
{
string row1= item.ChildNodes[1].InnerText;
string row2= item.ChildNodes[2].InnerText;
string row3= item.ChildNodes[3].InnerText;
string row4= item.ChildNodes[4].InnerText;
string row5= item.ChildNodes[5].InnerText;
string row6= item.SelectNodes("/small_images/small_image[0]").ToString();
string row7= item.SelectNodes("/small_images/small_image[1]").ToString();
string row8= item.SelectNodes("/small_images/small_image[2]").ToString();
string row9= item.SelectNodes("/small_images/small_image[3]").ToString();
string row10= item.SelectNodes("/small_images/small_image[4]").ToString();
string row11= item.SelectNodes("/small_images/small_image[5]").ToString();
string row12= item.SelectNodes("/small_images/small_image[0]").ToString();
string row13= item.SelectNodes("/small_images/small_image[1]").ToString();
string row14= item.SelectNodes("/small_images/small_image[2]").ToString();
string row15= item.SelectNodes("/Aciklamalar/Aciklamala[0]").ToString();
string row16= item.SelectNodes("/Aciklamalar/Aciklamala[1]").ToString();
string row17= item.SelectNodes("/Aciklamalar/Aciklamala[2]").ToString();
string row18= item.ChildNodes[9].InnerText;
SqlConnection bag = new SqlConnection(ConfigurationManager.ConnectionStrings[""].ConnectionString);
string ekle = "insert into TABLE(row1,row2,row3,row4,row5,row6,row6,row7,row8,row9,row10,row11,row12,row13,row14,row15,row16,row17,row18) values('" + row1 + "','" + row2+ "','" + row3+ "','" + row4+ "','" + row5+ "','" + row6+ "','" + row7+ "','" + row8+ "','" + row9+ "','" + row10+ "','" + row11+ "','" + row12+ "','" + row13+ "','" + row14+ "','" + row15+ "','" + row16+ "','" + row17+ "','" + row18+ "')";
SqlDataAdapter da = new SqlDataAdapter(ekle, bag);
DataSet ds = new DataSet();
da.Fill(ds);
}
}
mssql insert to multiple tag System.Xml.XPathNodeList null object.
mssql insert allrow
Help
Thanks..