WHAT IS SERIALIZATION ?
Serialization is converting an object to a format in which it can be saved (exported) as file or a physical medium. A simple and basic example would be, if we create an XML from a Dataset it is called Serialization.
DataSet ds = new DataSet();
String connStr = ConfigurationManager.ConnectionStrings[“DatabaseConnectionString1”].ToString();
SqlConnection myConnection = new SqlConnection(connStr);
String sql = “select * from tblCategory”;
da = new SqlDataAdapter(sql, myConnection);
catch (Exception ex)
The above code will write an XML file called info.xml from a Dataset called “ds” into xmls folder in root of website.
Alternatively we can use some advanced options to format the data which is being written.
Some options are. Some of the attributes available in Microsoft .Net Framework are as follows:
♣ XmlWriteMode.DiffGram — Writes the entire DataSet as a DiffGram.
♣ XmlWriteMode.IgnoreSchema — Writes the current contents of the DataSet as XML data, without an XML Schema Definition language (XSD) schema.
♣ XmlWriteMode.WriteSchema — Writes the current contents of the DataSet as XML data with the relational structure as inline XSD schema.
For more articles updates and sourcecodes please visit dotnetcoderoom