More
Image
Convert SqlDataSource into a DataTable
By JC.Adinarayana Reddy On 20 Dec 2016
Categories: Ado.net
Use the below code to convert SqlDataSource into a DataTable.
 
private DataTable ConvertToDataTable(SqlDataSource sd)
{
  System.Data.DataView dv = new System.Data.DataView();
  System.Data.DataTable dtExcel = new System.Data.DataTable();
  dv = (System.Data.DataView)sd.Select(DataSourceSelectArguments.Empty);
  dtExcel = dv.ToTable();
  return dtExcel;
}

 


Comments
Message :
Comments
JC.Adinarayana Reddy
.net
.net