DataView dv = ObjectDataSource1.Select() as DataView;
DataViewRowCollection dvRows = dv.Table.Rows;
string myContent = dvRows[0][0];
This returns the value in the first column of the first row of the results.
The select() method also returns other data types as shown below.
This table is reproduced from: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.select.aspx
Return type | Action |
|---|---|
The IEnumerable is returned by the Select method. | |
A DataView is created by using the DataTable and returned by the Select method. | |
The DataView is returned by the Select method. | |
The first DataTable of the DataSet is extracted and a DataView is created and returned by the Select method. | |
The object is wrapped in a one-element IEnumerable collection and returned by the Select method. |
No comments:
Post a Comment