Home Forums C Programming MFC:GetRecordCount() Reply To: MFC:GetRecordCount()



Sureyly GetRecordc**t is a great function. I am not an experienced C++ user but that problem is with many of the database programmers working in different languages. I got this problem while working on an ASP project.  So coming to your point. The GetRecordc**t is supported by both Access and SQL Server. I can’t speak for sure on other platforms, but I’ve been told it’s a pretty widely supported feature and I’d assume most vendors have some way of doing it.
So why isn’t it working for you? Well it’s supported only if the recordset supports approximate positioning (adApproxPosition) or bookmarks (adBookmark).
And here is another solution to that. If you only need the records count you can use SELECT COUNT(field_name) FROM table_name; and use where clause in it fr more refinement. With some thought and a little bit of trial and error, you’ll soon be counting anything you want in the database!