Hi,
Here I will code how to convert the objects to datatable Column names . All the business objects in particular class is going to be the Datatable column names, in the below code  Mktdetails is my class and by creating the object am passing parameter to the objToDataTable function. Find the below code for detailed code.


//Additional Namespaces to be added
using System.Data;
using System.Reflection;

//Calling the function in Pageload
protected void Page_Load(object sender, EventArgs e)
{
  DataTable dt = new DataTable();
  Mktdetails obj = new Mktdetails();
  dt = objToDataTable(obj);
}

//creating the class with objects
public class Mktdetails
{
   public string Name { get; set; }
   public string Place { get; set; }
   public string Age { get; set; }
   public string Country { get; set; }
   public string Mobile { get; set; }
   public string Email { get; set; }
}



//converting the objects to DataTable
private DataTable objToDataTable(Mktdetails obj)
{
    DataTable dt = new DataTable();
    Mktdetails objmkt = new Mktdetails();           
    foreach (PropertyInfo info in typeof(Mktdetails).GetProperties())
    {
      dt.Columns.Add(info.Name);
    }
    dt.AcceptChanges();
    return dt;

}