DataTable dt = ((DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty)).ToTable(); or DataTable dt = ((DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty)).Table;
If you set the DataSourceMode to DataReader, here is how to read the data:
IDataReader reader = (IDataReader)SqlDataSource1.Select(DataSourceSelectArguments.Empty); while (reader.Read()) { //your code here } reader.Close(); reader.Dispose();