Thursday, December 18, 2008

DataReader to DataTable


public class DataUtils: System.Data.Common.DataAdapter
{
public DataUtils()
{
//
// TODO: Add constructor logic here
//
}

public int FillFromReader( DataTable dataTable, IDataReader dataReader )
{
return this.Fill( dataTable, dataReader );
}
}



How to call


DataUtils _objDataUtils = new DataUtils();

objDataUtils.FillFromReader( dataTable, dr ); //converts a datareader into a datatable

No comments: