How to get the database record count in MS SQL Server 2005?
Posted on 2010-08-18
I have an aspx web page that I use privately to return records from a Microsoft SQL Server 2005 database file. The page works great. It allows me to view and pretty-print the records, which is just what I want. There is one annoying thing however. If the database is empty, the page loads with a NullReferenceException. I was wondering if there was Visual Basic code I could use to test the database for a zero record count to avoid this error. My old Delphi Borland Database Engine had a MyTable.RecordCount property that could be checked. I don’t see that the ASP.Net SQLDataSource component has a similar property that can be read. How or can this be done?