views:

98

answers:

1

I am using MFC. I need a control just like listControl, it has such functions:

MyListControl mylistControl = new MyListControl();
mylistControl.setDataSource(...);
mylistControl.setSQLStatement("select a, b, c, d from table where a > 3");

and system will have a listControl which is populated with the data from database, and generate the corresponding columns a, b, c, d respectively. If there is such kind of a control, please tell me. If you have any suggestion, please let me know. Thanks in advance!

+5  A: 

Depending on your platform you will need different code. You will need to use a GUI framework, there is no GUI standard library in the C++ language.

If you want Windows and C++ you can use MFC's CListCtrl, but this is not as powerful as you mentioned and you need to do your own data loading.

The more portable way would be to use Qt and it's QListView QSqlDatabase classes.

Brian R. Bondy
It's also worth noting that wxWidgets has the powerful wxGrid control
Diaa Sami