How do you find the number of rows in a DataGrid using .net compact framework?
views:
614answers:
2
+1
A:
Try querying the binding context of the DataGrid: DataGrid.BindingContext[DataGrid.DataSource].Count
Or, assuming the data source is a DataTable and you know something about the data source, you can also try ((DataTable)dataGrid1.DataSource).Rows.Count
or the equivalent.
lc
2009-05-05 16:13:33
I am using a DataReader or else I would have found the number of rows from that.
runxc1 Bret Ferrier
2009-05-05 17:52:02
A:
Are you using a DataReader with a DB SQL call? If so you can use multiple resultsets to return the row count in your SQL call.
Here's a good example of what I'm describing at the link below.
Determine how many records the DataReader is about to return
CJCraft.com
2009-05-07 18:29:16