I have written a C++ command line program that does calculations and at the end, writes the results to an MS-SQL server database using CRecordset classes and ODBC connection. The problem is when I execute the program multiple times on one computer, so that several processes intend to write results to the database at the same time, some processes fail to write all data and do not proceed until the end (get stuck). I guess to solve this issue I have to speed up the database access. What I experienced that the opening and closing of CRecordset objects takes some significant time.
Thanks a lot, I have to get into using the profiler as I have never done that before. Beside that, do you know a way how to open CRecordset objects (tables) in a faster way (maybe by handing certain parameters to the open() function). I opened the recordsets as "dynaset". It looks like it takes too long as the database has filled up with data over the time and the problems occurred only now.
I recently discovered SQLAPI++, a C++ library for encapsulating database access across all the popular database, including SQL Server. It may be worth taking a look, all this stuff may already be sorted there.
I would have thought that you're loop should be more like: