Hi,
This definitely can be done, but the exact implementation depends on the given database and your tested application. And from what exactly should be compared: i.e. raw data from the database can be additionally processed by the different layers of your application. E.g. different date/time format can be applied, or first name can be combined with the last name and displayed as a single string in the grid, while in the, say, grid source they are separate entities, likewise in the database table. So it is possible to do a 'simple' compare if you compare raw data from the database with the contents of the DataSource property of your grid, but you must resort to more 'complex' approach if the database table data are compared against the displayed contents of the grid.
The general approach is like this:
-- Get data from the database. TestComplete's ADO object can be used for this;
-- Transform obtained data to some 'comparable' form: array, dictionary, etc.;
-- Get data from your tested aplication. Either what is displayed in the grid or as a values of the grid's data source, etc.;
-- Transform obtained data to some 'comparable' form: array, dictionary, etc.;
-- Preprocess data if needed (e.g. apply the same format to date/time values);
-- Do actual data comparison. More or less intelligent, depending on your needs, tested application, data from the database, etc.