Content will come soon ...
Introduction : In this article i am going to share about how to copy a datatable to a new datatable object , and how to add a new row to the datatable. Overview : Generally we used datatable object to store out table data, sometime we want to store that datatable temporally to a another datatable object that time we need to copy the datatable and store to newly created object . It's a best practice to copy our main datatable when we need that datatable multiple times and used the copyed object. We can add a new column dynamically to the newly created object. Code Example : Syntex : DataTable dest = MainDatatable; Connection String : <connectionStrings> <add name="conn" connectionString="Data Source=anil\SQLEXPRESS2012;Initial Catalog=MyDB; User ID=sa;Password=sa1" providerName="System.Data.SqlClient" /> </connectionStrings> C# Code : SqlConnection con = new SqlConnec...
Comments
Post a Comment