The CTableView class - CListView-based grid for really huge datasets | CodeGuru

The CTableView class – CListView-based grid for really huge datasets

   Environment: VC6 SP4, Windows 98, 2000 In my last project I had to implement transparent access (via ADO) to huge dataset that had more than 2,700,000 rows (it is displayed on the image above). This table was located on MS SQL Server 6.5 and had size 1.9 GB. I was attempting to use virtual […]

Written By
CodeGuru Staff
CodeGuru Staff
Nov 26, 2001
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

  

Environment: VC6 SP4, Windows 98, 2000

In my last project I had to implement transparent access (via ADO) to huge dataset that had more than 2,700,000 rows (it is displayed on the image above). This table was located on MS SQL Server 6.5 and had size 1.9 GB. I was attempting to use virtual CListCtrl, dynamic cursors, static cursors, multithreading, etc, etc. Really nothing could help me. Response time was endless, or server was hung up because of too heavy loading.

So I made this CTableView class. Access was implemented with really good response time (server platform was very modest – PPro/256MB/SCSI). The CTableView class is derived from CListView and implements simple sequential dataset access algorithm (which can be found in file TableView.cpp, section “Grid engine”). Seeking through dataset is also available. Class dynamically creates corresponding SELECT statements. These statements is used for retrieving data from your dataset. CTableView dynamically inserts these data into embedded CListCtrl and deletes the obsolete data from it. So CListCtrl is not virtual and contains only the items that are visible in the window. Class doesn’t use any sizeable internal cache (only tiny map-type collection).

Scrolling through dataset is implemented by scrollbar’s substitution – “iterator bar”. Really it is right-aligned vertical toolbar with six buttons. Rejection of scrollbar caused by the features of the sequential dataset access.

Of course, for normal response time your dataset (table) MUST be indexed (see documentation).

If you will need to solve similar problems then pay your attention to this class. Maybe it really can help you.

All the documentation is located in file TableView.rtf. I was trying to make documentation as clear as possible, but in some topics it is not enough comprehensible. You may have questions after reading about “ORDER BY value”, etc. Please look at example on the last page of the documentation. Then you will make all these questions clear as these topics are NOT really complicated, simply I had difficulties when I was describing them. Good luck!

Downloads

Download demo project (SQLView for MS SQL Server/ADO) – 106 Kb

Download source – 17 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.