We have a Windows application written in Visual Studio 2003/MFC/C++
which uses the MFC Dao Database classes. The application works fine
with a Microsoft Access database. We are now converting the program
so that it can use ODBC, we have done this by creating connections
from a local MDB file to external tables using CDaoQueryDef and an
ODBC connection string. This was suggested as the best way to convert
without making many code changes.
Besides writing the code that connects the tables, we had to add
dbSeeChanges as a parameter to most of the CDaoRecordset Open calls.
We now have the application hooked up to an SQL Server 2000 database
that was upsized from the equivalent Access 2000 database file.
When we run the program, the initialization goes well, the program
reads alot of data and shows it to the user. Everything looks good at
this point, no errors at all. But then, when we try to do anything
with the program after that, we keep getting a:
3151 ODBC--Connection to 'SQL Server(local' failed
Error. This error occurs in functions that worked fine on program
startup. The error occurs on any database activity whatsoever.
Can anybody give me an idea about what could be the problem? Could
the program be running out of connections? Are CDaoRecordset objects
not being closed properly? The program keeps several DAO recordsets
open during the duration of the program. The reason is that the main
window uses a cached list view and the program constantly needs
provide data in response to LVN_GETDISPINFO messages. Any
suggestions as to what the problem could be are greatly appreciated.
Paul Dembowski
Liberty Street Software |