Skip to main content

Posts

Showing posts from February, 2013

XML vs User defined table type

Suppose , I have to insert multiple records at a single click. The option for a developer to insert the data in database with the help of 2 options. 1. With XML 2. With User defined table type. Here, we are defining both these options one by one. 1.With XML We have a grid with 3 columns boxid, quantity and weight and we have picked the data from the gridview and store these data in 3 different array objects .suppose in the below example quantity is a string has value “200,300,140”.we fetch the values from string to array. string[] arrrQ = quantity.Split(','); //fetch the value from string to array string[] arrW = weight.Split(','); string[] arrB = boxtypeId.Split(','); XmlDocument oXmlProductDetail = new XmlDocument(); // create an object of XmlDocument class XmlElement oXmlElement = oXmlProductDetail.CreateElement("doc");// create an element with specified name ...