Tutorial :Asp.net Datasource - view sql data by lookin at datasource object?



Question:

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.


Solution: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();  }  


Solution:2

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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »