Monday, February 20, 2012

RecordCount in SQL CE?

Does somebody know how to obtain the recordcount from a SqlCeResultSet ?

Thanks in advance!

See this.

|||

Ilya,

Please could you explain your post a little more, since I cannot make it to work.

int rowCount = ((IBindingList)resultSet.ResultSetView).Count;

I'm using VS 2005, Net CF 2.0 SP2 and SQL CE 3.1

thanks in advance!

|||

I’m not quite sure what to explain here, this single line of code is rather primitive. Let me try it: you get ResultSetView from ResultSet, cast it to IBindingList and get Count property which contains number of records.

Are you a VB developer? If so use any free online C# to VB converter to get VB code.

|||

int count = ((System.Collections.ICollection)rs.ResultSetView).Count;

You could try using above line to get the row count of the ResultSet.

1 comment:

Anonymous said...

If performance is a key issue then Expression Tree based solution in this context will have some performance penalties as reflection is involved during the decoding of expressions.
http://www.dapfor.com/en/net-suite/net-grid/features/performance

Post a Comment