1

Is there a way to view data that is returned from db by looking at DataSource or DataSourceView object in codebehind? I'm trying to view DataSourceView in debug but I don't see the data returned.

dev.e.loper
  • 35,446
  • 76
  • 161
  • 247

2 Answers2

3

Use your datasource to fill a datatable or dataset and you can loop through the records and columns, but if you are looking for something which is going to give you a point-blank representation of the sql results, your best option would be binding it to a datatable.

TheTXI
  • 37,429
  • 10
  • 86
  • 110
  • so there doesn't seam to be a way to see data by looking just at datasource object? – dev.e.loper Apr 29 '09 at 15:59
  • I am not certain, but I think in newer versions of visual studio there was a way to see a table-view of data returned when you are debugging and set a breakpoint in the program and you highlight over a datatable/datasource, but this is just from my foggy memory. – TheTXI Apr 29 '09 at 16:11
1
DataView dv = (DataView) YourDataSourceObject.Select(DataSourceSelectArguments.Empty);
for (int i = 0; i < dv.Table.Rows.Count; i++)
{
    string c = dv.Table.Rows[i]["c"].ToString();
}
Alper
  • 1,393
  • 13
  • 16