Best Regard's Prabhakar
Mark as Answer if its helpful to you Kumaraspcode2009@gmail.com
protected void btnSubmit_Click(object sender, EventArgs e) { String strXMLdata = string.Empty; XmlReader xmlr = null; using (SqlConnection conn = new SqlConnection(ConnString)) { //open the xml file and assign the data in the file to a string using (FileStream xmlStream = File.OpenRead(Server.MapPath("~/App_Data/Data.xml"))) { strXMLdata = new StreamReader(xmlStream).ReadToEnd(); } //inserting xml data to SQL SqlCommand cmd = new SqlCommand("INSERT INTO rgn_Xml (XMLdata) VALUES(@XmlData)", conn); cmd.Parameters.Add(@XmlData ", SqlDbType.Xml); cmd.Parameters["@XmlData "].Value = strXMLdata.Trim(); conn.Open(); cmd.ExecuteNonQuery(); } }
Mark this as answer, if it is..... With regards Nishithraj Narayanan
Login to post response